-3

I have a file.cpp which as an file.h included. This works on windows. Is there a easy way to change the code to be compiled on linux or do I have to rewrite all of it.

Thanks in advance.

4

1 回答 1

3

Some Pointers towards Porting Code to different OS:

  1. Check all the system headers included in the file. If there are OS specific headers, put them under OS specific macros and add different header files appropriate to Linux OS
  2. Check all the system function calls and replace them.
  3. Check if there are any compiler specific macros or code present and change it.
  4. Check if the data types used are supported in all OS.
于 2012-12-12T11:31:00.790 回答