views:

48

answers:

4

I wish to develop applications which should work both on Windows and Linux Operating Systems. Please help me how to proceed.

+4  A: 

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

Laurens Ruijtenberg
Hey: you can build projects for Linux (with GCC) even though they were developed in Visual Studio (well at least if he does not use C++/Cli). development and building the release are two different things.
smerlin
A: 

Check out Mono.

"An open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET"

Johan Olsson
A: 

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.

Rickard
+1  A: 

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.

smerlin