Find the answer to your Linux question:
Results 1 to 4 of 4
Hello everybody. I was wondering if it was possible to configure GCC to compile Linux applications and output a Windows executable. But do so while on Linux. I believe the ...
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    2

    Linux App -> Windows Executable?

    Hello everybody.

    I was wondering if it was possible to configure GCC to compile Linux applications and output a Windows executable. But do so while on Linux.

    I believe the correct term is Cross Compiler. And I believe I want to make one with Cygwin, because Cygwin is made to take Linux apps and output Windows exes.

    Could someone please tell me if I'm thinking right about this? And if I am, how I would go about making a Cross Compiler with GCC and Cygwin? There's a few howto's I've found with Google, but they're either outdated or I can't understand any of them.

    Thanks for reading!

    -Mike

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Hello,

    these two ways differ from each a bit.

    If you want to do a real cross-compile, you can't use anything UNIX (Posix) specific that is not contained in the Windows runtime library (the WinAPI). This means you have to write the source code exactly like you did in Windows for a Windows program. (Or you can only employ the rudimentary standard C/C++)
    So if you know how to write Windows programs or have obtained the source code of one, this is the way to go.

    Cygwin is kind of an thin emulator layer which "intercepts" function calls in the source code and guesses how it can map the behaviour of such a command to the equivalent action in Windows. This is favourable if you have the sourcecode of a UNIX tool and want it to run with few or no changes in the source code. But you have to compile it specifically for the Cygwin environment.
    Debian GNU/Linux -- You know you want it.

  3. #3
    Just Joined!
    Join Date
    Sep 2008
    Posts
    2
    I see. Thank you.

    So it's not all too possbile to do what I want to accomplish?

  4. #4
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    I don't know -- this depends on the particular application you want to port. The more it relies on system core services, the more difficult it becomes.

    But most probably you arrive faster with CoLinux or a full fledged emulator instead.
    Debian GNU/Linux -- You know you want it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...