Compiling with MinGW

Forgive me for this basic question, but I am a Visual Basic / Delphi programmer trying to learn the finer points of compiling a C++ application with a non-visual compiler :slight_smile: I have a program that has two header files and three source files. It must have SDL linked in with it. Here is the makefile that was supplied with the program:

all:dungeonmaker

dungeonmaker: DungeonMaker.o main.o DMPlusMovie.o
g++ -o dungeonmaker DungeonMaker.o main.o DMPlusMovie.o sdl-config --libs

DungeonMaker.o: DungeonMaker.cpp DungeonMaker.h
g++ -ggdb3 -Wall -c -o DungeonMaker.o DungeonMaker.cpp

main.o: main.cpp DungeonMaker.h
g++ -ggdb3 -Wall -c -o main.o main.cpp sdl-config --cflags

DMPlusMovie.o: DMPlusMovie.cpp DMPlusMovie.h
g++ -ggdb3 -Wall -c -o DMPlusMovie.o DMPlusMovie.cpp

I have downloaded the latest development version of SDL, and no matter where I put the sdl-config file, the make program tells me that it is not a valid file or directory. I have asked the program’s developer, and he says that since he’s added SDL he hasn’t compiled in Windows, so I’m on my own. Any help would be appreciated. Thanks.

Eric_______________________________________________________

Hi Eric,
This is a little OT to your question so I hope you don’t mind.

Are you aware that there is already a port of the SDL headers for
Delphi/Kylix. You can find more information about it @
http://www.delphi-jedi.org/Jedi:TEAD_SDL_HOME.
The distribution comes with quite a few 2D and 3D examples that work
under both Windows and Linux from the same project file.

Sorry for not being more helpfull with your compilation query.

L8R,

Dominique
http://www.DelphiGamer.com := for all your Object Pascal game
development needs;

epankoke at csdatasol.net wrote:> Forgive me for this basic question, but I am a Visual Basic / Delphi programmer trying to learn the finer points of compiling a C++ application with a non-visual compiler :slight_smile: I have a program that has two header files and three source files. It must have SDL linked in with it. Here is the makefile that was supplied with the program:

all:dungeonmaker

dungeonmaker: DungeonMaker.o main.o DMPlusMovie.o
g++ -o dungeonmaker DungeonMaker.o main.o DMPlusMovie.o sdl-config --libs

DungeonMaker.o: DungeonMaker.cpp DungeonMaker.h
g++ -ggdb3 -Wall -c -o DungeonMaker.o DungeonMaker.cpp

main.o: main.cpp DungeonMaker.h
g++ -ggdb3 -Wall -c -o main.o main.cpp sdl-config --cflags

DMPlusMovie.o: DMPlusMovie.cpp DMPlusMovie.h
g++ -ggdb3 -Wall -c -o DMPlusMovie.o DMPlusMovie.cpp

I have downloaded the latest development version of SDL, and no matter where I put the sdl-config file, the make program tells me that it is not a valid file or directory. I have asked the program’s developer, and he says that since he’s added SDL he hasn’t compiled in Windows, so I’m on my own. Any help would be appreciated. Thanks.

Eric



SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I have downloaded the latest development version of SDL, and no matter where I put the sdl-config file, the make program tells me that it is not a valid file or directory. I have asked the program’s developer, and he says that since he’s added SDL he hasn’t compiled in Windows, so I’m on my own. Any help would be appreciated. Thanks.

sdl-config is a unix shell script. er, it’s an sh script which is unix-centric.

Your clue is the #!/bin/sh as the first line of the file. On Unix, the #! is
a magic number that means that the text starting at the next position is
should be prepended to the command line, more or less. So running sdl-config
on unix will actually run /bin/sh sdl-config.

On windows, that doesn’t generally work so you can’t use that sdl-config
with MinGW as is.

It will work with Cygwin. Cygwin includes ports of the relevant shells and will
interpret the #! correctly.

Other alternatives would be to make an sdl-config.bat or some other like
kludge or just not use sdl-config but rather put in all the correct switches
by hand.

Hope that helps. I guess this is off topic to the list in general. Sorry.On Fri, Dec 28, 2001 at 10:01:02PM +0000, Dominique Louis wrote:

Eric


Greg V. (hmaon)

Okay, maybe I need to rephrase my question… Can anyone tell me how to
compile a program using MinGW that includes SDL? That’s what I really need
to know. I hope this isn’t actually off topic, but I figured since SDL was
the “problem”, this would be a good list to go to (I know the problem is
actually me, but what can you do?)

At 05:35 PM 12/28/01 -0500, you wrote:>On Fri, Dec 28, 2001 at 10:01:02PM +0000, Dominique Louis wrote:

I have downloaded the latest development version of SDL, and no
matter where I put the sdl-config file, the make program tells me that it
is not a valid file or directory. I have asked the program’s developer,
and he says that since he’s added SDL he hasn’t compiled in Windows, so
I’m on my own. Any help would be appreciated. Thanks.

sdl-config is a unix shell script. er, it’s an sh script which is
unix-centric.

Your clue is the #!/bin/sh as the first line of the file. On Unix, the #! is
a magic number that means that the text starting at the next position is
should be prepended to the command line, more or less. So running sdl-config
on unix will actually run /bin/sh sdl-config.

On windows, that doesn’t generally work so you can’t use that sdl-config
with MinGW as is.

It will work with Cygwin. Cygwin includes ports of the relevant shells and
will
interpret the #! correctly.

Other alternatives would be to make an sdl-config.bat or some other like
kludge or just not use sdl-config but rather put in all the correct switches
by hand.

Hope that helps. I guess this is off topic to the list in general. Sorry.

Eric


Greg V. (hmaon)


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I was aware of that and I’ve already looked into them. Thanks for the
info, though.

At 10:01 PM 12/28/01 +0000, you wrote:>Hi Eric,

This is a little OT to your question so I hope you don’t mind.

Are you aware that there is already a port of the SDL headers for
Delphi/Kylix. You can find more information about it @
http://www.delphi-jedi.org/Jedi:TEAD_SDL_HOME.
The distribution comes with quite a few 2D and 3D examples that work under
both Windows and Linux from the same project file.

Sorry for not being more helpfull with your compilation query.

L8R,

Dominique
http://www.DelphiGamer.com := for all your Object Pascal game development
needs;

@Eric_Pankoke wrote:

Forgive me for this basic question, but I am a Visual Basic / Delphi
programmer trying to learn the finer points of compiling a C++
application with a non-visual compiler :slight_smile: I have a program that has two
header files and three source files. It must have SDL linked in with
it. Here is the makefile that was supplied with the program:

all:dungeonmaker
dungeonmaker: DungeonMaker.o main.o DMPlusMovie.o
g++ -o dungeonmaker DungeonMaker.o main.o DMPlusMovie.o
sdl-config --libs
DungeonMaker.o: DungeonMaker.cpp DungeonMaker.h
g++ -ggdb3 -Wall -c -o DungeonMaker.o DungeonMaker.cpp
main.o: main.cpp DungeonMaker.h
g++ -ggdb3 -Wall -c -o main.o main.cpp sdl-config --cflags
DMPlusMovie.o: DMPlusMovie.cpp DMPlusMovie.h
g++ -ggdb3 -Wall -c -o DMPlusMovie.o DMPlusMovie.cpp
I have downloaded the latest development version of SDL, and no matter
where I put the sdl-config file, the make program tells me that it is not
a valid file or directory. I have asked the program’s developer, and he
says that since he’s added SDL he hasn’t compiled in Windows, so I’m on
my own. Any help would be appreciated. Thanks.
Eric



SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Well, on Linux, you get this in CFLAGS: (that’s when you’re compiling,
from .c or .cxx to .o)
-I/usr/local/SDL-1.2.2/include -I/usr/local/SDL-1.2.2/include/SDL -D_REENTRANT

and this in LDFLAGS:
-L/usr/local/SDL-1.2.2/lib -Wl,-rpath,/usr/local/SDL-1.2.2/lib -lSDL -lpthread

With MinGW, you’ll want -I/path/to/SDL/headers in the compilation step
and maybe -lSDL -L/path/to/SDL/libs in the link step.
Where by “libs” I mean the .a file(s).

I’m sure there’s some documentation on MinGW and gcc usage available
out there. I’ve seen it.On Fri, Dec 28, 2001 at 07:38:54PM -0500, Eric Pankoke wrote:

Okay, maybe I need to rephrase my question… Can anyone tell me how to
compile a program using MinGW that includes SDL? That’s what I really need
to know. I hope this isn’t actually off topic, but I figured since SDL was
the “problem”, this would be a good list to go to (I know the problem is
actually me, but what can you do?)


Greg V. (hmaon)

Okay, I’m a little confused. We’re talking about the MingW32, right?
There’s a set of scripts that allow you to:

A. Cross compile SDL itself
B. Cross compile any SDL based application.

Location: http://www.libsdl.org/Xmingw32/

I downloaded and installed the cross compiler, than ran the
cross-configure/make scripts to build my win32 versions from Linux. I’ve
used it and tested it on my wife’s Win32 system - you just include the
SDL.dll files from the SDL cross compile.

Am I totally off base, or is this what you have in mind?

Now if I can do the same thing to produce MacOS binaries… :slight_smile: BTW -
what’s a basic copy of CodeWarrior going for nowadays? I’ve got 8.5 on
an iMac I’d like to test. I’ll get 9 and perhap X later on… What
coding convolutions can I look forward to in making my apps equally
cross-compatible to Linux/Win32/MacOS/MacOSX? Basic #ifdefs and endian
conversion is all I’m initially vaguely familiar with… So far I’ve
only done Linux and Win32 cross-compile on x86.

Cheers,
Mike

Greg Velichansky wrote:>On Fri, Dec 28, 2001 at 07:38:54PM -0500, Eric Pankoke wrote:

Okay, maybe I need to rephrase my question… Can anyone tell me how to
compile a program using MinGW that includes SDL? That’s what I really need
to know. I hope this isn’t actually off topic, but I figured since SDL was
the “problem”, this would be a good list to go to (I know the problem is
actually me, but what can you do?)

Well, on Linux, you get this in CFLAGS: (that’s when you’re compiling,
from .c or .cxx to .o)
-I/usr/local/SDL-1.2.2/include -I/usr/local/SDL-1.2.2/include/SDL -D_REENTRANT

and this in LDFLAGS:
-L/usr/local/SDL-1.2.2/lib -Wl,-rpath,/usr/local/SDL-1.2.2/lib -lSDL -lpthread

With MinGW, you’ll want -I/path/to/SDL/headers in the compilation step
and maybe -lSDL -L/path/to/SDL/libs in the link step.
Where by “libs” I mean the .a file(s).

I’m sure there’s some documentation on MinGW and gcc usage available
out there. I’ve seen it.

Okay, I’m a little confused. We’re talking about the MingW32, right?
There’s a set of scripts that allow you to:

A. Cross compile SDL itself
B. Cross compile any SDL based application.

Location: http://www.libsdl.org/Xmingw32/

I downloaded and installed the cross compiler, than ran the
cross-configure/make scripts to build my win32 versions from Linux. I’ve
used it and tested it on my wife’s Win32 system - you just include the
SDL.dll files from the SDL cross compile.

Yes, it’s very nice. I’m not sure if newer compiler versions are available
but I have been able to build gcc-3.0.1 as a linux-hosted cross-compiler
to windows. (Haven’t done it for 3.0.2 yet since I haven’t even been using it.)

Am I totally off base, or is this what you have in mind?

No, I was thinking of MinGW proper by which I mean Windows-hosted and targeted
gcc.

Now if I can do the same thing to produce MacOS binaries… :slight_smile:

I’d love to see something like this as well. I’d bet lots of $$$ that
some version of gcc will build with the right CPU targets but I don’t know
where you’d get the right headers and import libs and I don’t know if
binutils will do what you want.

That being said, I don’t know anything about Macs. Somebody else should answer
all this, please.

[…]On Fri, Dec 28, 2001 at 11:32:46PM -0600, Mike Vanecek wrote:


Greg V. (hmaon)

Greg,

I’ve got a newer version of xmingw32 on my page:
http://www.ferzkopp.net/Software/CrossMingw/index.html

Cheers
Andreas>

On Fri, Dec 28, 2001 at 11:32:46PM -0600, Mike Vanecek wrote:

Okay, I’m a little confused. We’re talking about the MingW32, right?
There’s a set of scripts that allow you to:

A. Cross compile SDL itself
B. Cross compile any SDL based application.

Location: http://www.libsdl.org/Xmingw32/

I downloaded and installed the cross compiler, than ran the
cross-configure/make scripts to build my win32 versions from Linux. I’ve
used it and tested it on my wife’s Win32 system - you just include the
SDL.dll files from the SDL cross compile.

Yes, it’s very nice. I’m not sure if newer compiler versions are available
but I have been able to build gcc-3.0.1 as a linux-hosted cross-compiler
to windows. (Haven’t done it for 3.0.2 yet since I haven’t even been using it.)

Am I totally off base, or is this what you have in mind?

No, I was thinking of MinGW proper by which I mean Windows-hosted and targeted
gcc.

Now if I can do the same thing to produce MacOS binaries… :slight_smile:

I’d love to see something like this as well. I’d bet lots of $$$ that
some version of gcc will build with the right CPU targets but I don’t know
where you’d get the right headers and import libs and I don’t know if
binutils will do what you want.

That being said, I don’t know anything about Macs. Somebody else should answer
all this, please.

[…]


Greg V. (hmaon)

Here’s what I get from sdl-config on a windows system (using zsh):
(keep in mind this is 1.2.2 but it should be similar)

D:/OpenSource/zshSrc/Src>sdl-config --cflags
-Id:/mingw/include -Id:/mingw/include/SDL -Dmain=SDL_main

D:/OpenSource/zshSrc/Src>sdl-config --libs
-Ld:/mingw/lib -lmingw32 -lSDLmain -lSDL -mwindows

D:/OpenSource/zshSrc/Src>sdl-config --version
1.2.2

Sam> -----Original Message-----

From: Eric Pankoke [mailto:epankoke at csdatasol.net]
Sent: Friday, December 28, 2001 6:40 PM
To: sdl at libsdl.org
Subject: Re: [SDL] Compiling with MinGW

I was aware of that and I’ve already looked into them.
Thanks for the
info, though.

At 10:01 PM 12/28/01 +0000, you wrote:

Hi Eric,
This is a little OT to your question so I hope you don’t mind.

Are you aware that there is already a port of the SDL headers for
Delphi/Kylix. You can find more information about it @
http://www.delphi-jedi.org/Jedi:TEAD_SDL_HOME.
The distribution comes with quite a few 2D and 3D examples
that work under
both Windows and Linux from the same project file.

Sorry for not being more helpfull with your compilation query.

L8R,

Dominique
http://www.DelphiGamer.com := for all your Object Pascal
game development
needs;

epankoke at csdatasol.net wrote:

Forgive me for this basic question, but I am a Visual Basic
/ Delphi

programmer trying to learn the finer points of compiling a C++
application with a non-visual compiler :slight_smile: I have a program
that has two

header files and three source files. It must have SDL
linked in with

it. Here is the makefile that was supplied with the program:

all:dungeonmaker
dungeonmaker: DungeonMaker.o main.o DMPlusMovie.o
g++ -o dungeonmaker DungeonMaker.o main.o DMPlusMovie.o
sdl-config --libs
DungeonMaker.o: DungeonMaker.cpp DungeonMaker.h
g++ -ggdb3 -Wall -c -o DungeonMaker.o DungeonMaker.cpp
main.o: main.cpp DungeonMaker.h
g++ -ggdb3 -Wall -c -o main.o main.cpp sdl-config --cflags

DMPlusMovie.o: DMPlusMovie.cpp DMPlusMovie.h
g++ -ggdb3 -Wall -c -o DMPlusMovie.o DMPlusMovie.cpp
I have downloaded the latest development version of SDL,
and no matter

where I put the sdl-config file, the make program tells me
that it is not

a valid file or directory. I have asked the program’s
developer, and he

says that since he’s added SDL he hasn’t compiled in
Windows, so I’m on

my own. Any help would be appreciated. Thanks.
Eric



SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl