Solidity开发bug汇总

编译器与代码版本不一致问题

更多区块链技术与应用分类:

区块链应用    区块链开发

以太坊 | Fabric | BCOS | 密码技术 | 共识算法 | 比特币其他链

通证经济传统金融场景 | 去中心化金融 | 防伪溯源 | 数据共享 | 可信存证

(代码版本pragma solidity ^0.4.25),产生如下报错:

{ "component": "general", "formattedMessage": "StringUtil.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.4.25-develop.2019.12.3+commit.8f645f02.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version\npragma solidity ^0.4.25;\r\n^----------------------^\n", "message": "Source file requires different compiler version (current compiler is 0.4.25-develop.2019.12.3+commit.8f645f02.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version", "severity": "error", "sourceLocation": { "end": 24, "file": "StringUtil.sol", "start": 0 }, "type": "SyntaxError" }

解决:

改为pragma solidity ^0.4.2

^0.4.25表示0.4.25以上,0.5以下的版本,因此与当前编译器版本不兼容,导致错误。


原文链接:Solidity开发bug汇总

猜你喜欢

转载自blog.csdn.net/JonasErosonAtsea/article/details/109236216