Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-06-2005, 02:58 PM   #1
Registered: Mar 2005
Distribution: slackware 11, arch 2007.08
Posts: 154

Rep: Reputation: 30
Question Cross Compiling

I want to cross compile some programs (especially of the mozilla variety and home grown) for Windows on my Linux computer. I have gcc, but I have no Idea how to cross compile with it, or what I need to keep in mind when doing it.

Any help would be greatly apreciated.
Old 05-06-2005, 03:35 PM   #2
LQ Guru
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,661

Rep: Reputation: 229Reputation: 229Reputation: 229
"I want to cross compile some programs (especially of the mozilla variety and home grown) for Windows on my Linux computer. I have gcc, but I have no Idea how to cross compile with it"

Here is a tutorial for cross compiling with Wintel as the target.

Steve Stites
Old 05-07-2005, 01:02 AM   #3
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
Also check out Cygwin, DJGPP & Mingw. It's fairly easy to setup a toolchain for either of them under Linux that will output Windows executable code. I have all 3 setup under Slackware 10. Best I recall DJGPP was the most difficult to get working. There is a good guide for doing a Cygwin toolchain at colinux. The only bad thing about a Cygwin toolchain is that your app will require the cygwin1.dll be available for running it. All I use them for is CLI apps though.

Last edited by DaHammer; 05-07-2005 at 01:03 AM.
Old 02-10-2006, 09:41 PM   #4
Rufus T. Firefly
LQ Newbie
Registered: Feb 2006
Location: Hermosa CA
Distribution: Fedora
Posts: 8

Rep: Reputation: 0
According to the link posted by Jailbait (up thread) the syntax for cross compiling to Windows is:

i586-mingw32msvc-gcc -o hello.exe hello.c

Using FC4 -- I've installed the following 4 rpm's ...


which went smoothly and I can compile my hello.c test case that
executes fine in a linux shell but nowhere can I find the executable command 'i586-mingw32msvc-gcc' for cross compiling to win32.

What did I miss? Are there other rpms I need to load to get the cross compile features? Is there an 'installing mingw for dummies' tutorial that I could follow?

Your help is appreciated -- thank you.
Old 02-28-2006, 05:45 PM   #5
Senior Member
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

Rep: Reputation: 45
You've looked in the usual places ? (Under Debian, the Mingw binaries end up in /usr/bin.)


Old 03-01-2006, 11:12 AM   #6
Senior Member
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,725

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
this is from my xbox programming post:

i needed mingw to cross-compile to .xbe format which is similar to winnt pe format (*.exe).

i used the following gcc switches (but i got compile errors)
gcc hello-world.c -std=gnu99 -ffreestanding -nostdlib -fno-builtin -fno-exceptions -march=i386 -I/usr/local/openxdk/i386-pc-xbox/include -I/usr/local/openxdk/include


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
distcc cross architecture compiling Moebius Linux - Software 2 01-09-2008 06:20 AM
wx widget and cross compiling guideweb Programming 0 09-20-2005 11:06 PM
cross-compiling? jon_k Programming 3 12-09-2004 09:36 AM
cross compiling with g++ hornofsalvation Linux - Newbie 2 10-09-2004 10:29 PM
Building cross-compiling toolchain radhapriya Linux - Software 1 06-25-2004 12:01 AM

All times are GMT -5. The time now is 01:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration