how the cross-platform compiler works
From the source code to the executable program, can be divided into 2 steps (the following statement differs from most tutorials).
The first step is to compile your own code into a. obj file;
The second step is to link the library files you use (such as STL) to the. obj file generated by your own code to generate the final executable file.
The code that you write yourself is cross-platform, this is the C + + Standard Committee to the various compilers to see, without your worry;
The library files you use, a lot of them are implemented by the Assembly, not cross-platform, so each platform has its own implementation, this also do not worry about you.
Your job is to write your own code, find the library file for the platform, tell the compiler where they are, and the compiler will generate a cross-platform executable file for you.
Where to find the library file
On windows, download VS, you just need to write your own code in VS and find the library file task vs will do it for you.
Linux, download the gcc/g++, you only need to write your own code, find the library file task gcc/g++ will do for you.
On Mac, download Xcode, you just have to write your own code and look for the library files task Xcode will do for you.
But since you can't run a vs/gcc/xcode on Android, you need to go to Google's official website to download an android-specific compiler, the NDK. Then you just have to write your own code and look for the library files task that the NDK will do for you.