Current location - Trademark Inquiry Complete Network - Futures platform - Are there any defects in the cross-platform of C++?
Are there any defects in the cross-platform of C++?
Have a lot of understanding of cross-platform:

1. Compile once and run everywhere, such as java and flash, because it runs on a virtual machine.

2. Code once, compile everywhere, and compile on various platforms without modifying the code. Of course, there is no problem with standard C++ code. If you need to use interfaces, threads, messages and other functions. You must use platform-specific code. At this time, you can choose a third-party library that is said to be compatible, such as Qt, sdl and so on.

So the C++ language itself can be said to be cross-platform, because each platform has a standard C++ compiler.

Because the API provided by the standard C++ library is far less abundant than the standard library of the java platform, the development with C++ completely depends on the system API of the corresponding platform.

If you want to write cross-platform C++ code, then programmers need to make an API abstraction layer, such as:

#ifdef _WINDOWS

#define funcA() win_funcA()

#endif

#ifdef _LINUX

#define funcA() linux_funcA()

#endif

//win_funcA () and linux_funcA () are corresponding system APIs, which do the same thing on two different platforms.

//or the complication is that macros are replaced by definitions.