Developing common applications working on both Windows OS and Linux OS with Visual C++ 2008
I wish to develop applications which should work both on Windows and开发者_StackOverflow中文版 Linux Operating Systems. Please help me how to proceed.
This is currently not possible in Visual Studio 2008. The Visual C++ compiler has no support for the ELF format and no support for any linux library whatsoever. Maybe you can look at alternatives such as the cygwin enviroment.
If you do develop an application in Windows and you want to port it to linux you should check the following things:
- Make use of cross platform API's (e.g. QT UI framework)
- Make sure your code complies with the C++ standard.
- Get GCC and a linux distro with all the required libs
edit: typos
If you want to develop applications with a graphical user interface (GUI), i recommend the Qt Framework. It comes with its own IDE (which isnt bad either), but once you created your project with it (or a texteditor of your choice..), qmake can generate Visual Studio 2008 project files for you. I myself develop cross platform applications using Qt and QtCreator, but i use Visual Studio sometimes, because of the superior debugging features. I have a little batch file i use to create my Visual Studio 2008 project files, its content:
@echo off
set QMAKESPEC=win32-msvc2008
qmake -t vcapp
One thing you have to consider with this double-rail approach, is that, when you add new source files (*.cpp) for your Applications, you have to add those in the qt-project file (*.pro) and not within Visual Studio. Afterwards you can generate an updated Visual Studio project with the batch file again.
Check out Mono.
"An open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET"
I can recommend getting a solid x-platform build/project environment. I use CMake which is very nice for this. Using a common project description, it can generate native makefiles on Linux and on windows CMake can spit out visual studio solutions. This makes it trivial to keep the project building on both platforms and you can choose to work in whatever IDE fits you for the day (KDevelop works with CMake out of the box for instance).
I believe SCons is nice for this as well.
精彩评论