[英]compiler problem with solidity and truffle
So I'm trying to learn to build NF token, and I cloned a repo.所以我正在尝试学习构建 NF 令牌,并克隆了一个 repo。 It's supposed to work with truffle.它应该与松露一起使用。 The thing is I have an error with the compiler, and I don't really understand.问题是我的编译器有错误,我不太明白。 Indeed what I know is that the solidity compiler have problems with different versions, hence working with truffle CLI that works better with different versions projects.事实上,我所知道的是,solidity 编译器在不同版本中存在问题,因此使用 truffle CLI 可以更好地处理不同版本的项目。
So I tried to change to "pragma solidity >0.5.8 <0.6.0;", I did sudo truffle compile, and still have the error.所以我尝试更改为“pragma solidity >0.5.8 <0.6.0;”,我做了sudo truffle compile,但仍然有错误。
The error message I got is:我得到的错误信息是:
my typo `Source file requires different compiler version (current compiler is 0.7.4+commit.3f05b770.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version我的错字`源文件需要不同的编译器版本(当前编译器是 0.7.4+commit.3f05b770.Emscripten.clang) - 请注意,夜间构建被认为严格低于发布版本
I know that I need to find a good version of solidity and truffle, but I believe that my versions are okay:我知道我需要找到一个好的版本的solidity和truffle,但我相信我的版本还可以:
Truffle v5.0.5 (core: 5.0.5) Solidity v0.5.0 (solc-js) Node v14.16.0
Change the compiler version in the truffle-config.js file to match the one your are using in your smart contract更改 truffle-config.js 文件中的编译器版本以匹配您在智能合约中使用的版本
Sometimes even after changing the compiler version in truffle config the error does not go away so instead of using the specific version like ^0.6.0 use >0.6.0有时,即使在 truffle 配置中更改编译器版本后,错误也不会 go 消失,因此不要使用 ^0.6.0 等特定版本,而是使用 >0.6.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.