Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross compilation tutorials [duplicate]

Possible Duplicate:
Cross platform programming

I've written some code using wxwidgets in c++. But I am not able to compile the same code for both windows and linux. Actually I'm a bit scared by the preprocessor directives generated by code-blocks ide. I wonder if anyone could point out some nice tutorials for learning cross-compilation.

Thanks in Advance

Jvc

like image 423
jvc Avatar asked Jun 22 '26 09:06

jvc


1 Answers

If you want to build a cross platform program, you will stumbl across a few kind of problems.

Cross compilers problem

Some compilers are offering non-standard functionalities that might not work on other compiler. You have to make sure that compiler functionnalitie's you use are standard or available on all the compilers you use (An exemple would be the VC++ #pragma that wasn't usable on gcc until version 4.2.1)

Platform specific functions and libraries

Guess what, if you include <windows.h> it won't compile on a linux system (this is madness I know). So you must try to avoid those platform specific libraries/function. If you ever have to use them, try to encapsulate their use and select the specific class you need to compile on different system.

Here is a wonderful guide posted by the Mozilla foundation : https://developer.mozilla.org/en/C___Portability_Guide

like image 62
Drahakar Avatar answered Jun 23 '26 23:06

Drahakar