VC written procedures how to ensure cross-platform compilation

Category: C/C++ -> Tools/Lib Author: luo5do Date: 2014-11-23 01:36:31
2014-11-23 01:36:31
With VC have 5,6 years, and the program's operating platform has been WINDOWS, now the company's 3D engine project may be made cross-platform compilation, is to ask the program must be conforming C + + code on other platforms C + + compiler on the smooth translation (eg under LINUX GCC). I only know MFC is certainly not used, but in addition in addition, what should pay attention to it?
2014-11-23 02:11:59
with stl and gtk written. . . Do not use the api
2014-11-23 02:28:51
with VC development of cross-platform program, in theory, can be achieved, but it is hard. After all, VC is just designed for Windows, it is best able to support multiple platforms using compiler development, such as using gcc.
2014-11-23 02:46:27
using only stl, using vc generated makefile, gcc compiler used in the windows, through which instructions can be cross-platform!
2014-11-23 03:25:55
If you do not have a Windows feature, then, cross-platform compiler no difficulty ah? under Windows if you do not engage in the development, VC why we must do. Strange!
2014-11-23 03:57:48
Do with MFC, do not use WINDOWS API, do not use any of the relevant header files with WINDOWS or LIB file. Only the standard c + + and some C + + libraries: If STL, BOOST, ACE and so on.
2014-11-23 04:34:26
There xpcom .. very nb's.
2014-11-23 04:52:28
at least to do the following:

1. follow the C + + standard. Seems to be a nonsense, in fact, there are many content involved. Fortunately, compilers are now possible to move closer to the standard.

2. Do not call the system functions (Windows API or under Unix / Linux under System Calls) or platform-specific libraries.

3. using only C + + Standard Library and some other platform-independent libraries, such as Boost libraries.
2014-11-23 05:19:45
abandon MFC, into QT
2014-11-23 05:52:45
For this, my advice is to isolate logic and concrete realization, platform-independent and accurate to say that you want to use the platform with are related to design a good interface to the underlying operating system will involve the operation of the upper stuff completely isolated, so that would be better.
2014-11-23 06:09:45
recommend using wxWindows library
2014-11-23 06:38:54
To use a macro to perform a large number of conditional compilation.
Some code is not actually cross-platform. Use qt or the like wxWindows can not solve all the problems.