Dnia Tue, 27 Mar 2007 10:02:11 +0200, Ivan Vecerina napisa³(a):
But what about C++ runtime and C++ implementation?
What about them? I have a lot of C++ code which works under
Solaris (Sparc), Linux (PC) and Windows (PC). Including some
complete "applications". As Ivan said, if you use only standard
components and cross-platform libraries, there's no reason why
it won't work. (I actually develop mostly under Unix, and port
to Windows, but there's no reason why the other direction won't
work just as well.)
What about
executable formats?
What about them? C++ almost always compiles to directly
executable code, which is platform specific. He'll obviously
have to recompile with a native compiler for each platform.
Portable libraries isn't enough. Is VS linker
able to produce executables for Linux? [ELF] Is it able to use
other runtime C++ implementations than "MSVCRT & Co."?
Ivan clearly said that you have to rebuild your application for
each platform. You don't use VC++ to build for Linux, any more
than you'd use g++ to build a native application for Windows.
(In the case of g++, you can, of course, but VC++ works much
better on that platform.)
I think better for OP is to use GCC, because of its port for
Windows platform [MinGW and Win32 binutils].
My experience is that it is less well integrated into the
Windows environment, and that it is better to use VC++ under
Windows, g++ under Linux, and often, the native C++ compiler
under other Unices (although g++ sometimes has the edge there).
I would take a hard look at the build environment. I don't
think that a Visual Studios project is directly exportable, and
I'm not sure if their makefiles are compatible with anything
else. I find makefile compatibility to be a serious problem,
and I do install GNU make everywhere, originally for portability
reasons, but I've gradually come to use its more complex
features to create a complete build system. Similarly, I've
never written a real application where there wasn't some
automatically generated code, generally using AWK, so I'll also
install a Unix look-alike toolkit (MSys, or possibly UWin).
Even on Linux
it's impossible to use one compiler front-end to generate code
for Windows
G++ uses the same front-end for all of its platforms.
- one have to have separate binutils, compiler
front-end and rutime library for Windows to generate Windows
executables on Linux [it's called "cross-compiling"].
I doubt MSVS could cross-compile for other platforms than Windows.
Visual Studios isn't sold as a cross-compiler.