Re: GCC C/C++ application to run on Windows

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Jon M. Hanson
Date:  
To: klsmith2020, Main PLUG discussion list
Subject: Re: GCC C/C++ application to run on Windows
On Fri, Aug 15, 2008 at 11:08:29AM -0700, Jon M. Hanson wrote:
> On Fri, Aug 15, 2008 at 11:02:20AM -0700, keith smith wrote:
> >
> >
> > Hi,
> >
> > I'm thinking of writing a small application that can run on both Linux and Windows written in GCC C/C++ that will utilize MySql running on Linux .
> >
> > Initially I need the application to run on Windows XP or Vista and connect to the Linux box to access MySql.
> >
> > Is it possible to write an application using GCC that will run both on Linux and Windows?? If so what should I be looking into?
> >
> > Is there a better approach?
> >
> > Thanks in advance,
> > Keith
> > ------------------------
>
> It's not possible because Linux and Windows use different executable
> file formats.
>


I should clarify this by saying that you can have the same code for both
Windows and Linux as long as you don't do anything Windows or Linux
specific (POSIX-compliant code should compile cleanly on both
platforms). You will have to compile it once for Windows and once for
Linux becuase of the different executable formats. You can't take a
Linux executable and run it on Windows or vice versa.

You can get GCC for Windows as well as Linux. I run it under Cygwin all
the time. Under Windows it will produce Windows executables.

There may be a way to cross-compile for Windows under Linux with the
right parameters passed to GCC but I've never looked in to that or tried
it.

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss