首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >编译错误

编译错误
EN

Ethereum用户
提问于 2020-07-02 11:38:34
回答 1查看 948关注 0票数 0

嗨,伙计们,当我尝试用松露开发编译时,我得到了这个错误。

代码语言:javascript
复制
    truffle(develop)> compile
Compiling your contracts...

    Compiling ./contracts/StarNotary.sol

    /mnt/d/Blockchain/Project2Test/node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721.sol:3:1: ParserError: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version

pragma solidity ^0.6.0;
^---------------------^

Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragma solidity ^0.6.0".
Please update your truffle config or pragma statement(s).
(See https://truffleframework.com/docs/truffle/reference/configuration#compiler-configuration for information on
configuring Truffle to use a specific solc compiler version.

在the 721中,我将语用转换为语用稳健性>=0.4.24 < 0.7.0;solidity openzeppelin-。

在那之后,我得到了一个错误

代码语言:javascript
复制
truffle(develop)> compile
Compiling your contracts...

    Compiling ./contracts/StarNotary.sol

/mnt/d/Blockchain/Project2Test/node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721.sol:106:51: ParserError: Expected '{' but got reserved keyword 'override'
function balanceOf(address owner) public view override returns (uint256) {
EN

回答 1

Ethereum用户

发布于 2020-07-02 16:23:14

OpenZeppelin的合同所要求的坚固版本与在The中配置的版本不匹配。

您可以升级Tru显以使用solc 0.6,也可以将OpenZeppelin降级到使用Solcv0.5的2.5版本。

  • OpenZeppelin v3.0,v3.1要求solc v0.6
  • OpenZeppelin v2.5要求solc v0.5
票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/84721

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档