c++ - Visual Studio 2015 : switch between remote compilation (on Raspberry) and local compilation (on Windows)

标签 c++ linux windows visual-studio-2015 cross-compiling

我有一个项目,我想在我的本地 Windows 机器上运行和测试,但我想部署在 Raspberry 上。

我设法设置了“用于 Linux 开发的 Visual C++”扩展。我创建了一个新的解决方案,使用“New Solution>Visual C++>cross-platform>Linux”。

它运行良好,我可以在 Raspberry 上编译我的代码。

但是,我想轻松地在这个远程 linux 目标和 windows 目标之间切换,同时共享相同的源代码。

我该怎么做才能实现这一目标?

谢谢你的帮助。

最佳答案

您的 VS 解决方案中需要两个项目,一个用于 Linux,另一个用于 Windows。您可以在项目之间共享源代码,因此,一旦您创建了第一个项目,就可以为另一个平台创建第二个作为空项目,然后拖放源代码。您可能希望在 #if def 中包含特定于平台的代码(例如,测试 WIN32)。

顺便说一句:如果您仍在使用 VS2015,那么您已经落后于当前的 VCLinux 版本了。

关于c++ - Visual Studio 2015 : switch between remote compilation (on Raspberry) and local compilation (on Windows),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50100641/

相关文章:

c++ - 从 x64 进程获取函数表

Java ProcessBuilder 在 Linux 中执行 git 时返回退出错误 128(一些 git 命令工作正常)

linux - 一些Linux设备驱动程序是如何自动加载/卸载的?

ruby-on-rails - 如何在 Windows 上安装 RedCloth?

c++ - 为复杂数据结构重载 [] C++ 运算符

c++ - 帮助 WinAPI 工具栏

C++:奇怪的段错误

php - Smarty 模板无法在本地服务器上运行

c - GtkSourceGutter - 如何在特定行上呈现图标或文本

windows - Visual Studio Express 2013 for Windows 和 Visual Studio Express 2013 for Windows Desktop 有什么区别?