繁体   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