Cross-compiling from Windows to Linux. Getting binaries for Linux


I was given a task – to deal with cross-compilation of C and C ++ applications from under Windows for Linux.

I tried using Cygwin for this purpose. Installed this shell, launched it. Installed the cygwin-gcc-3.3.6-glibc-2.3.2-linux compiler (old truth). And I tried to compile the usual HelloWorld from it and run it under Linux, everything worked out.

But the task is to run a cross-compiler from our Windows application, which will compile some files. How can this be done in general? It's just that in this case you have to start Cygwin, and from it gcc-linux or g ++ – linux. So far, I do not see the launch paths from our Windows Cygwin application and then start the compiler in it.

Maybe there are some other ways out of the situation? How can you configure a separate compiler for Windows that will compile binaries for Linux?


  1. Install cygwin.
  2. Create a script that launches the assembly.
  3. Call the script from the application.

In script (cmd file)

set CYGWIN_BIN=c:\cygwin\bin

CYGWIN_BIN\gcc.exe ...

In the application


There is also such a cross-compilation facility : crosstool-ng .

Scroll to Top