Visual Studio Code C++編譯環(huán)境

環(huán)境

OS CPU Tool
Win10 x64 VS2015+LLVM+VSCode

步驟

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

問題集

1. 終端亂碼

  • 現(xiàn)象:終端輸出亂碼
  • 原因:
  • 解決:把首選項的"code-runner.runInTerminal"改為true,重啟VSCode

如何指定生x86還是x64
給clang命令添加選項-target,值為
x86:i686-pc-windows-msvc
x64:x86_64-pc-windows-msvc

2. C++編譯警告(未解決)

  • 現(xiàn)象:LNK4217警告
XXX.o : warning LNK4217: 本地定義的符號 ___std_terminate 在函數(shù) "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 在函數(shù)std::basic_string::~basic_string()導入
  • 解決:???

3. C++鏈接錯誤

  • 現(xiàn)象:error LNK2019
error LNK2019: 無法解析的外部符號 __imp____RTDynamicCast
error LNK2019: 無法解析的外部符號 __imp____RTtypeid
  • 原因:
    沒有連接RTTI相關(guān)庫
  • 解決:
    添加庫文件"vcruntime.lib"
#pragma comment(lib,"vcruntime.lib")
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容