无法更改VSCODE中的Solc编译器版本

发布于 2025-01-19 04:13:25 字数 1623 浏览 1 评论 0原文

在尝试使用布朗尼进行编译时,我会在VScode中遇到此错误。我知道这个错误来自我的一个文件中的一个与编译器不同的Pragma solidity版本:

PS C:\Users\me\Documents\Code\Blockchain\brownie_fundme> brownie compile
INFO: Could not find files for the given pattern(s).
Brownie v1.18.1 - Python development framework for Ethereum

Compiling contracts...
  Solc version: 0.8.13
  Optimizer: Enabled  Runs: 200
  EVM Version: Istanbul
CompilerError: solc returned the following errors:

ParserError: Source file requires different compiler version (current compiler is 0.8.13+commit.abaa5c0e.Windows.msvc) - note that nightly builds are considered to be strictly less than the released version
 --> C:/Users/me/.brownie/packages/smartcontractkit/[email protected]/contracts/src/v0.6/vendor/SafeMathChainlink.sol:2:1:
  |
2 | pragma solidity ^0.6.0;
  | ^^^^^^^^^^^^^^^^^^^^^^^

我尝试使用Juan Blanco的'Solidity'Vscode Extension更改编译器版本到“ 更改Global/Workspace Compiler版本(远程) )“选择0.6.0版本。 (我确认了“ solidity.compilesusingremoteversion”:“ v0.6.0+commit.6c089d02”到我的settings.json)。

但是,当我运行布朗尼编译时,我仍然会遇到相同的错误:

... ParserError:源文件需要不同的编译器版本(当前编译器为 0.8.13 +commit.abaa5c0e.windows.msvc)... ”,表明我的编译器版本保持不变。

(我将默认的编译器设置为远程,并且在进行这些更改后也尝试重新启动任何开放终端。)

我已经使用PIP安装了Solcx,并且在我的“ C:/users/Me”目录中也有一个.solcx文件夹,其中包含一个文件夹“ solc-v0.8.13”。我尝试删除该文件夹并再次编译,但布朗尼自动下载了相同的v0.8.13。

我很喜欢如何更改全局或工作区编译器版本。 Solc的版本可以从我的VSCODE设置以外的其他地方覆盖吗?

I am getting this error in VSCode while trying to compile using brownie. I understand this error is from the pragma solidity version in one of my files being different from my compiler:

PS C:\Users\me\Documents\Code\Blockchain\brownie_fundme> brownie compile
INFO: Could not find files for the given pattern(s).
Brownie v1.18.1 - Python development framework for Ethereum

Compiling contracts...
  Solc version: 0.8.13
  Optimizer: Enabled  Runs: 200
  EVM Version: Istanbul
CompilerError: solc returned the following errors:

ParserError: Source file requires different compiler version (current compiler is 0.8.13+commit.abaa5c0e.Windows.msvc) - note that nightly builds are considered to be strictly less than the released version
 --> C:/Users/me/.brownie/packages/smartcontractkit/[email protected]/contracts/src/v0.6/vendor/SafeMathChainlink.sol:2:1:
  |
2 | pragma solidity ^0.6.0;
  | ^^^^^^^^^^^^^^^^^^^^^^^

I have attempted to change my compiler version using Juan Blanco's 'Solidity' VSCode extension to "Change global/workspace compiler version (Remote)", selecting version 0.6.0. (I confirmed this adds "solidity.compileUsingRemoteVersion": "v0.6.0+commit.6c089d02" to my settings.json).

But when I run brownie compile again I still get the same error:

"...ParserError: Source file requires different compiler version (current compiler is 0.8.13+commit.abaa5c0e.Windows.msvc)...", showing that my compiler version remains unchanged.

(I have the default compiler set to remote, and I also tried restarting any open terminals after making these changes.)

I had installed solcx with pip, and also have a .solcx folder in my "C:/Users/me" directory, which contains a folder "solc-v0.8.13". I tried deleting that folder and compiling again, but brownie automatically downloaded the same v0.8.13.

I'm stumped on how to change the global or workspace compiler version. Could the version of solc be getting overridden from somewhere other than my VSCode settings?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

書生途 2025-01-26 04:13:25

添加以下Brownie-Config.yaml文件添加到您的项目:

compiler:
  solc:
    version: 0.6.12

当您编译时,Brownie将从配置下载SOLC版本。

Add following brownie-config.yaml file to your project:

compiler:
  solc:
    version: 0.6.12

When you compile, brownie will download solc version from config.

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