简体   繁体   English

Solidity 和 truffle 的编译器问题

[英]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.

相关问题 使用 truffle 编译时出现问题,卡在导入 openzeppelin - Problem compiling with truffle, stuck on importing openzeppelin Solidity:抽象合约并覆盖 VRFConsumerBase 编译器/版本/导入问题 - Solidity: Abstract contract and override VRFConsumerBase compiler/version/import issues solidity: 错误信息 源文件需要不同的编译器版本 - solidity : error information Source file requires different compiler version SOLIDITY REMIX 编译器,在部署我的合约后收到此错误(无效的 BigNumber 字符串) - SOLIDITY REMIX compiler, after deploying my contract getting this ERROR (Invalid BigNumber string) 结构定义和编译器错误有什么问题? - What is the problem here in struct definition and compiler error? 使用 Modelica CombiTable1Ds 时的编译器问题 - Compiler problem when using Modelica CombiTable1Ds 如何解决VSCODE中链接器命令失败的编译器错误这个问题 - how to solve this problem compiler error that linker command failed in VSCODE 内联函数的问题导致“成员访问不完整类型”编译器错误 - Problem with inlining functions gives “Member access into incomplete type” compiler error Code::Blocks 和 C++ 编译器问题。 无法编译头文件 - Code::Blocks, and C++ Compiler problem. cant compile a header 优化switch语句时Visual Studio 2005 C编译器问题 - Visual Studio 2005 C compiler problem when optimizing a switch statement
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM