I having the error below when I tried compile the contract. Should I downgrade the truffle version? If yes, which version because I couldn't find the appropriate version for sol 0.4.18. Thanks

SyntaxError: Source file requires different compiler version (current compil
er is 0.4.24+commit.e67f0147.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity 0.4.18;

Yes, each Truffle version comes with a built-in solidity compiler. One possible solution is to downgrade to the version of Truffle that corresponds to solidity 0.4.18 which is the version the author is signaling he or she worked with.

It may be more forward-thinking to bump the contract source up to 0.4.24. This is going to cause some syntax-level compiler complaints. They're not alarming to people who have worked with it for a while but dialect differences could be a nuisance if you're looking for a smooth path.

Hope it helps.

| improve this answer | |
  • Another option is to modify the source to allow compilation with newer versions pragma solidity ^0.4.18 (the ^ in front allow compilation with newer compilers compatibles with 0.4.18 ie all from the 0.4.xx stackoverflow.com/questions/22343224/…). – Ismael Jul 30 '18 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.