Maybe you can use the standard library (STL) or other libraries, such as BOOST.
You can also detect the compilation environment and select the specific code using the #if or #ifdef, for example:
#ifdef _MSC_VER
// Visual Studio
. . .
#else
#ifdef __GNUC__
// GCC
. . .
#endif
#endif