Remix compilation fails with Source file requires different compiler version

That new one worked! thanks. I think sometimes I was not waiting long enough.. the little green area over the compile button was not finished loading the new version, for some reason its taking a really long time for it to change.. there is that slight green thinking thing over the button and then it goes away.... it takes a long time to reset.. thx!

| abcoathup :zap: OpenZeppelin Team
March 22 |

  • | - |

Hi @Tedmcm,

It didn’t compile for me the first time, giving me an error.
I changed to the Release Candidate (I changed the GitHub import) and checked the Solidity compiler version and was able to compile.

I assume there may be some sort of caching issue.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.0.0-rc.0/contracts/token/ERC20/ERC20.sol";

contract Token is ERC20 {
  
    constructor () ERC20("TEDY", "TEDY") {
        _mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
    }
}

You could also try removing the github directory.

Another community member also had a similar issue: Remix: Parse error : source file requires different compiler version - #2 by abcoathup

1 Like