Visual Studio Code C++编译环境

环境

OS CPU Tool
Win10 x64 VS2015+LLVM+VSCode

步骤

  1. 安装VS2015(或者其他版本的VS)
  2. 安装LLVM
  3. 安装VSCode
  4. 在VSCode中搜索插件Code Runner并安装
  5. 重启VSCode

问题集

1. 终端乱码

  • 现象:终端输出乱码
  • 原因:
  • 解决:把首选项的"code-runner.runInTerminal"改为true,重启VSCode

如何指定生x86还是x64
给clang命令添加选项-target,值为
x86:i686-pc-windows-msvc
x64:x86_64-pc-windows-msvc

2. C++编译警告(未解决)

  • 现象:LNK4217警告
XXX.o : warning LNK4217: 本地定义的符号 ___std_terminate 在函数 "int `public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)'::`1'::dtor$3" (?dtor$3@?0???1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ@4HA) 中导入
  • 原因:???
    XXX.o : warning LNK4217: 本地定义的符号 ___std_terminate 在函数std::basic_string::~basic_string()导入
  • 解决:???

3. C++链接错误

  • 现象:error LNK2019
error LNK2019: 无法解析的外部符号 __imp____RTDynamicCast
error LNK2019: 无法解析的外部符号 __imp____RTtypeid
  • 原因:
    没有连接RTTI相关库
  • 解决:
    添加库文件"vcruntime.lib"
#pragma comment(lib,"vcruntime.lib")
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容