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