Author Topic: Cross compiling Windows -> Linux  (Read 4864 times)

Offline markpotts

  • Multiple posting newcomer
  • *
  • Posts: 15
Cross compiling Windows -> Linux
« 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

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Cross compiling Windows -> Linux
« Reply #1 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.
« Last Edit: December 31, 2013, 01:19:02 am by cacb »

Offline markpotts

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Cross compiling Windows -> Linux
« Reply #2 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

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Cross compiling Windows -> Linux
« Reply #3 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

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