简体   繁体   English

在Ubuntu(Netbeans)和Windows(Visual Studio 2012)中编译相同的c ++代码

[英]Compiling the same c++ code in Ubuntu(Netbeans) and Windows(Visual Studio 2012)

I have starded developing a c++ project under ubuntu. 我已经开始在ubuntu下开发一个c ++项目。 No I want to compile exactly the same code under Windows with Visual Studio 2012(I will add a GUI afterwards for the Windows version) Is this possible? 否,我想在Windows下使用Visual Studio 2012编译完全相同的代码(以后将为Windows版本添加GUI)可以吗? Or should I use Netbeans as well in Windows? 还是我也应该在Windows中使用Netbeans?

I use the gcc in Linux. 我在Linux中使用gcc。 To use the same libraries in Windows I must use cygwin right? 要在Windows中使用相同的库,我必须使用cygwin对吗? Do I need cygwin only to compile or also to execute the application? 我是否需要cygwin来编译或执行应用程序?

This is very important, it should be as easy as possible to run my Programm under Linux and Windows! 这非常重要,在Linux和Windows下运行我的Programm应该尽可能容易!

Thanks Florian 谢谢弗洛里安

Really depends on what you are linking to in windows. 确实取决于您在Windows中链接到的内容。 If you only link against the libstdc++ probably you can just compile your source code (after some tweaks) directly with MSVC. 如果仅链接到libstdc ++,则可以直接使用MSVC编译源代码(经过一些调整)。 Otherwise, you either need your dependencies already compiled for windows, or build them from source code (in case it is possible). 否则,您要么需要已经为Windows编译的依赖项,要么从源代码构建它们(如果可能)。 Using cygwin will allow you to use the gcc toolchain in both environments, but you won't be using VS2012 to compile. 使用cygwin将允许您在两种环境中都使用gcc工具链,但不会使用VS2012进行编译。

With so little information is hard to tell what you do you really need. 信息很少,很难说出您真正需要什么。 Try explaining your project to us. 尝试向我们解释您的项目。

I hope that helps. 希望对您有所帮助。

如果仅使用标准库,请确保可以在任何操作系统中编译,并且无法在VS上使用GCC,则可以安装mingw并在Netbeans或代码块或Eclipse上对其进行配置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM