Building a Linux C++ project in Visual Studio?
I have a C++ project that compiles in linux using Makefiles. I want to edit this project using Visual Studio 2005 IDE. How can I get it to build?
The reason I want to use Visual Studio 2005 on Windows is because I like the IDE environment instead of using VI in Linux and running 'make' after every change.
- 1 decade agoFavorite Answer
No matter what, if you want your program to run on linux, it's going to have to have linux available. You can't just hit the build/execute button in Visual Studio and expect it to run in linux. Even Cygwin can't help you there.
That said, it's perfectly possible to build *portable* C++ code in Visual Studio that compiles and executes in the same manner on both platforms. Simply use ANSI Standard C++. Yes, you'll lose out on a ton of features on both platforms, but it will at least *work* on both platforms. You could also target linux using Cygwin by linking against the Cygwin DLL, but you can't simply compile a binary using Visual Studio and have it work on linux.
You may want to try a linux-based C++ IDE, like KDevelop or Eclipse/CDT. (See sources below)Source(s): http://www.cygwin.com/ http://www.kdevelop.org/ http://www-128.ibm.com/developerworks/opensource/l...
- Rah-Mon HeurLv 41 decade ago
Hum, it's true that any version you compile using visual studio won't work on linux, but that's not the point. You can simply bring back the files on linux and gcc (or whatever) once you're satisfied with the result on windows, that way you need to use make only once.
To do that, you need to construct a console project in the visual studio IDE (if you have any kind of GUI stuff it's a bit more complicated), and add to it all your cpp/h files plus any specific compiler/options if there is any you want to use. It's possible that some things don't work exactly the same in the windows environment, use #if _MSC_VER to mark the code you need to change specifically for windows.
Other then that it should work quite easily
- dm_gsxrLv 41 decade ago
You can't. That's the short answer. It's because the visual studio environment is linking in libraries for Windows so your program won't work on Linux.
It sounds like what you need is more an IDE for Linux. Try taking a look at Eclipse http://www.eclipse.org/ It also appears to work on Windows XP so you can have a common environment between the two platforms if you do Windows development.