Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: markpotts on December 31, 2013, 12:40:14 am

Title: Cross compiling Windows -> Linux
Post by: markpotts on December 31, 2013, 12:40:14 am
Is there any way to configure C::B to build (but obviously not run) a Linux executable under Windows?
Mark
Title: Re: Cross compiling Windows -> Linux
Post by: cacb on December 31, 2013, 01:16:35 am
If you use g++ you can build the executable under mingw on windows, so yes.

Another option (somewhat more complex) is to use same code, but different build targets on Windows and Linux. I am using MSVC compiler on windows and g++ under linux. Works fine when you know what you are doing :-)

The easiest approach is using g++ everywhere, I guess.

EDIT: perhaps I misunderstood the question. Build linux executable under windows? Perhaps. But I guess it is much easier to install linux under WMware and build+run it there.
Title: Re: Cross compiling Windows -> Linux
Post by: markpotts on December 31, 2013, 05:45:16 pm
Thanks for the feedback. I am building an executable to run on a small embedded Linux appliance and was looking for a mechanism to allow me to do this on my Windows platform. The cross platform capabilities of C::B looked interesting in this context and so far I am impressed with its capabilities.

I am currently using C::B with MinGW however this seems to incorporates Windows specific libraries which will not be available under Linux and will require use of Posix equivalents. Identifying and addressing these incompatibilities was one of my goals. I think the suggestion of using a Linux VM is probably the best approach and the one I will adopt.

Mark
Title: Re: Cross compiling Windows -> Linux
Post by: stahta01 on December 31, 2013, 08:47:42 pm
Is there any way to configure C::B to build (but obviously not run) a Linux executable under Windows?
Mark

Yes, but it all depends on the Compiler Tool chain.
And, debugging is hard or impossible.

Look in this sub-form http://forums.codeblocks.org/index.php/board,22.0.html (http://forums.codeblocks.org/index.php/board,22.0.html)

Tim S.