'错误 HH606: 项目无法编译'当使用多个 solc 版本时
我正在尝试使用 2 个不同的编译器版本通过 Hardhat 编译 2 个不同的合约。我不断收到错误:
Error HH606: The project cannot be compiled, see reasons below.
The Solidity version pragma statement in these files doesn't match any of the configured compilers in your config. Change the pragma or configure additional compiler versions in your hardhat config.
Hardhat-config.js 中的 module.exports 看起来像这样:
module.exports = {
solidity: {
compilers: [
{
version: "0.4.18",
},
{
version: "0.6.0",
settings: {},
},
],
},
};
在合同中,编译器的定义如下:
pragma solidity ^0.4.18;
?
pragma solidity ^0.6.0;
我做错了什么 谢谢
i am trying to compile 2 different contracts through hardhat, using 2 different compilers versions. I keep getting the error:
Error HH606: The project cannot be compiled, see reasons below.
The Solidity version pragma statement in these files doesn't match any of the configured compilers in your config. Change the pragma or configure additional compiler versions in your hardhat config.
My module.exports in hardhat-config.js looks like this:
module.exports = {
solidity: {
compilers: [
{
version: "0.4.18",
},
{
version: "0.6.0",
settings: {},
},
],
},
};
Inside the contracts the compilers are defined like this:
pragma solidity ^0.4.18;
and
pragma solidity ^0.6.0;
What am i doing wrong? Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试在 smart_contract 中定义编译器版本,如下所示
pragma Solidity >=0.4.18 <=0.6.0;
Try defining the compiler versions in your smart_contract like this
pragma solidity >=0.4.18 <=0.6.0;
这就是你能做的,
检查将您的合同 pragma 更改为一个选项,让我们选择“pragma Solidity ^0.6.0;尽管始终建议使用截至本文为止的最新版本,但我们目前处于 pragma Solidity ^0.8.9;”
然后还将hardhat.config.js中的solidity版本更改为您在solidity合约中使用的相同版本并再次编译。
This is What you can do,
Check change your contracts pragma to one choice lets take "pragma solidity ^0.6.0; though it is always advisable to use the most current as of this post we are at pragma solidity ^0.8.9;"
Then also change the solidity version in your hardhat.config.js to the same version you used in your solidity contracts and compile again.