簡體   English   中英

使用 VS2019 為 Linux 編譯我的 C++ exe

[英]Compiling my C++ exe for Linux with VS2019

我用 VS2019 創建了一個 C++ 獨立 exe。 此 exe 使用 1 個外部資源文件。 此 exe 創建 WAV 文件。

它不使用任何特殊庫。

有人問我這個應用程序是否也在 Linux 下運行。

我需要做什么/檢查以查看是否/如何為 Linux 編譯我的應用程序,這是否可以使用 VS2019?

非常感謝你的幫助。

ps:我的項目屬性截圖如下: 羅斯

通常要為 Linux 構建 C++ 應用程序,您必須首先使用將為目標操作系統構建的編譯器。 在這種情況下,VS2019(及其關聯的編譯器)僅為 Windows 構建可執行文件。

如果您嘗試定位 Linux,您有兩種選擇:

  1. You can move over to a Linux system and build your project with the GNU c++ compiler (I recommend using CMAKE to build your project since it's not tied to any particular IDE and can generate makefiles for gcc). https://cmake.org/cmake-tutorial/

  2. 您可以為 Linux (WSL) 安裝 Windows 子系統,並使用 VS2019 進行遠程構建。 這些天你會在生產環境中看到越來越多的這種情況。 https://devblogs.microsoft.com/cppblog/linux-development-with-c-in-visual-studio-2019-wsl-asan-for-linux-separation-of-build-and-debug/

希望這可以幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM