![](/img/trans.png)
[英]undefined reference linking yaml-cpp program with mingw-w64 + cmake
[英]CPP codes linking in VScode with Mingw-w64 in Windows 10
我在 Windows 10 中使用 VScode 和 Mingw-w64 學習 C++。
今天,我觀看了如何在 Visual Studio 2019 中制作 header 文件並構建分離的代碼。
我想在 Visual Studio Code 編輯器中實現這個過程,但我遇到了鏈接錯誤。
我天真的解決方案就像
~$ g++ -c .\main.cpp .\add.cpp
~$ g++ .\main.o .\add.o -o test.exe
首先,將源代碼編譯成 object 文件。
其次,將這些 object 文件鏈接到執行文件。
無論如何它都可以工作,但是當我嘗試運行調試模式時,它不起作用。
我想我需要編輯launch.json文件,但我不知道......
以下圖片是關於我的情況。
如何一次構建這些分離的代碼?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.