LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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-31-2004, 12:44 PM   #1
fuzzyworm
Member
 
Registered: Sep 2003
Location: Stroud, UK
Distribution: Kubuntu, Debian
Posts: 149

Rep: Reputation: 15
Smile Is it possible to compile a windows .exe program using g++?


I have to write a few programs in c++ for my course. My machine is a linux machine, but the computers we use for the course are all windows machines. I usually compile my projects by sending them in, then compiling them using bcc, but it would be much easier if there were a way to compile them in linux, for example, though not essentially, with g++.

Thanks
 
Old 01-31-2004, 01:02 PM   #2
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
Have a look at this one
http://www.wxwindows.org/technote/crosscmp.htm
or do some googling :}


Cheers,
Tink
 
Old 01-31-2004, 02:52 PM   #3
llimllib
LQ Newbie
 
Registered: Aug 2002
Location: Philadelphia, US
Distribution: RH 9
Posts: 28

Rep: Reputation: 15
not that I know of on linux

I don't know how to do that from Linux; you can create C++ that is *compilable* (is that a word?) on Windows but not create a windows binary, AKAIK. You'd need to have all the Windows libraries and such installed. (possible with WINE?)

However, you can use Cygwin's version of g++ on Windows to build a Windows binary, and I think there's a "-fno-cygwin" (or something similar) flag which will make it not depend on the cygwin dll. This helps you because your code will probably be easier to port from g++/linux to g++/cygwin than from g++/linux to bcc/windows.
 
Old 02-01-2004, 04:28 AM   #4
synna
Member
 
Registered: Jan 2004
Posts: 40

Rep: Reputation: 15
Sure, you can do it with mingw check http://www.mingw.org/index.shtml . But its a little bit hard since you need to try it running wine, and wine has some bugs (Finally you don't know, is it a bug from wine, my app, both).

Hope this help
 
Old 02-01-2004, 10:13 AM   #5
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
If the C++ programs in question aren't making use of Windows-specific function calls and libraries, then it should be fairly easy to port them over after you've written them. I've done course work this way - just get them working in Linux using your g++ compiler, then give yourself a couple days after it's done to go use a Windows machine to compile them and work out any new problems. Most command-line C++ programs that do normal I/O (cout, cin, etc.) should be no problem; if you're doing stuff with graphics, MSFC, or anything else that would rely on a Windows library, it'd probably be trickier...
 
Old 02-05-2004, 04:55 PM   #6
fuzzyworm
Member
 
Registered: Sep 2003
Location: Stroud, UK
Distribution: Kubuntu, Debian
Posts: 149

Original Poster
Rep: Reputation: 15
Thanks everyone, I think I'll just stick with going into the lab to compile it
 
  


Reply



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
unable to compile .exe files under KDevelop stealthgate Linux - Software 2 09-16-2005 05:34 PM
require program that able to run *.exe in linux henrylam Linux - Newbie 1 05-24-2004 06:26 AM
Can I compile a windows .exe? odious1 Linux - Software 6 08-29-2003 11:36 AM
Program exe PlatinumRik Linux - General 4 04-12-2003 09:43 PM
Compile linux program for windows Mor_Petrus Programming 3 04-08-2003 11:11 AM

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

All times are GMT -5. The time now is 03:28 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