ANSI C++ for portability

Hi,

My questions about understanding what sould i do for c++ source code portability.

- How can i isolate my sorce code from OS depended libraries and GUI functions with C++?

- Can i make my soruce code compiled by gcc's C++ compiler and Visual C++ at the same time?

Thanks
1) Wrap any OS dependent call in a function, and put all these functions in one or more files separated from the non-OS-dependent code
In these files use the OS macros to switch functionality depending on where the program is compiled

2) Use strictly standard C++, avoid any compiler specific extension

3) Beware that the ranges of built-in types may vary depending on compiler and machine
Thank you for quick and useful answer Bazzy.

What do you think about GCC. Is this compiler enough to compile C++ code for multiple OS.

Thanks
Yes, you can use gcc as cross compiler
Topic archived. No new replies allowed.