News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Cross compiling Windows -> Linux

Started by markpotts, December 31, 2013, 12:40:14 AM

Previous topic - Next topic

markpotts

Is there any way to configure C::B to build (but obviously not run) a Linux executable under Windows?
Mark

cacb

#1
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.

markpotts

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

stahta01

Quote from: 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

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

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

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]