解决Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragm...

目前我的visual studio code的solidity默认版本是0.6.4,但truffle用的编译器是0.5.16版本的,用truffle compile报错Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragma solidity ^0.6.4".。

解决方法:

1、把sol改为

pragma solidity ^0.5.16;

2、打开扩展的solidity插件的设置




3、点击在settings.json中编辑,末尾添加一句:

    "solidity.compileUsingLocalVersion": "latest"


4、终端输入truffle compile,回车,编译成功。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。