编译器与代码版本不一致问题
更多区块链技术与应用分类:
以太坊 | 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汇总