I have to create an application which can be executed in Linux and Windows. My question is :
1: Will i have two executables. Each for an environment?
2: Do i have to write two totally different codes for different enviroments. If yes, is there anyway to MAP the code from one enviroment to another.
1. Yes. It can be hard to make executables that works on all Linux distributions. Distributing the source code so that the user can compile it himself is probably easier.
2. No. You can reuse a lot of code. All standard C++ should work on both Windows and Linux. For other things you can use cross platform libraries. If you have to write some parts differently for different platforms you can use macros to check what platform is being compiled on. example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// include linux headers (if needed)
// windows implementation
// linux implementation