'错误 HH606: 项目无法编译'当使用多个 solc 版本时

发布于 2025-01-15 03:17:24 字数 746 浏览 0 评论 0原文

我正在尝试使用 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-c​​onfig.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

变身佩奇 2025-01-22 03:17:24

尝试在 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;

野生奥特曼 2025-01-22 03:17:24

这就是你能做的,
检查将您的合同 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文