LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 01-09-2006, 04:06 PM   #1
Four
Member
 
Registered: Aug 2005
Posts: 298

Rep: Reputation: 30
compiling on linux for windows


Is it possible to compile a windows application on linux, so it works on windows?

I want to compile a game I made using OpenGL in C++, so that it runs on windows and I can show to my friends that have Windows XP.

Thank you!
 
Old 01-09-2006, 04:33 PM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
You can't do it directly because the resultant binary files would be different, but maybe you could try compiling on a Windows emulator such as wine.
 
Old 01-09-2006, 05:15 PM   #3
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
Wine not an emulator for windows. Its a API call interpreter or something like that. Could use bochs to install win98 or something and then get a compiler such as bloodshed c++ or something like that and compile. Bloodshead is a free gnu software. uses gcc and will create windows binaries.
 
Old 01-09-2006, 05:19 PM   #4
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
Originally Posted by exvor
Wine not an emulator for windows. Its a API call interpreter or something like that. Could use bochs to install win98 or something and then get a compiler such as bloodshed c++ or something like that and compile. Bloodshead is a free gnu software. uses gcc and will create windows binaries.
That sounds like too much hard work, I'm sure if you host the files somewhere someone from here will compile it for you.
 
Old 01-09-2006, 05:37 PM   #5
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
Hey dident say I was gonna show him the eazy way

I guess it wouldent be worth it if you were only gonna do this once no.
 
Old 01-09-2006, 05:49 PM   #6
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
I just checked the Wine application database and it looks as if you can use Dev-C++ (5.0.1) from within it. Although there are some issues of compiling from within the GUI.

graeme.
 
Old 01-09-2006, 05:49 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Even though one can run gcc as a cross-compiler there's the issue
of having to (most likely statically) compile all libraries involved,
plus one would have to know how Windows would interface with the
OpenGL-stuff that comes from Linux. I'd suggest to install cygwin
on a windows box and try it there ;}


Cheers,
Tink
 
Old 01-09-2006, 06:41 PM   #8
vivekr
Member
 
Registered: Nov 2005
Location: Coimbatore,India
Distribution: Fedora Core4
Posts: 68

Rep: Reputation: 15
If I have understood clearly,I think u forgot exvor's advise to use bochs for the job..
 
Old 01-09-2006, 07:48 PM   #9
Four
Member
 
Registered: Aug 2005
Posts: 298

Original Poster
Rep: Reputation: 30
Quote:
Hey dident say I was gonna show him the eazy way

I guess it wouldent be worth it if you were only gonna do this once no.
Thats great. Bochs seems too much work though. If I'm going to do this might as well make it easy to make costume levels, so everyone can enjoy and I'll release as opensource.

Well I'll probably post in a week or two the game here, after I make it nicer(to look at code, add comments etc) and "how to play" into the game. It already runs well on Linux however there are like no levels except that strange one I made to test the game. By the way this would be my first contribution to Linux community (in the form of code) . Right now levels are made using a hex editor, I'm going to change that .
 
Old 01-09-2006, 09:31 PM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,642
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
Usually, when you're compiling for Windows, you use one of the Windows-native compilers. It is my recollection that gcc does not produce Windows executables, but of course, it's not the only compiler out there.

Both Microsoft and Borland produce very good Windows compilers.

Source code that is prepared to be compiled by several different compilers, each appropriate to its own architecture, is quite common indeed.
 
Old 01-09-2006, 10:27 PM   #11
slantoflight
Member
 
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

Rep: Reputation: 35
From the title, it almost sounded like you were going to compile a crazy modified version of the linux kernel that'll load windows drivers and replace ntsokrnl.exe

But if for easy cross compilation, just design your code to be robust. Use as little OS independent functions in the core of your program. Use relative paths. etc.
Then add the optimizations for the OS later on.
 
  


Reply


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
cross-compiling windows console apps on linux nathan10177 Programming 2 10-28-2005 08:40 PM
Compiling Linux software under Windows - your advice? midiox Programming 6 10-20-2005 07:49 AM
Compiling Borland c++ windows source on linux.. arun79 Linux - Software 3 10-15-2004 04:14 PM
Compiling under Windows for Linux joseamuniz Linux - Software 2 06-25-2003 09:28 PM
Cross compiling - Windows Xp -> Linux groston Programming 1 05-31-2002 03:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:16 PM.

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