Compiling SDL Game under Windows with MinGW

Hi,

I want to compile my game now with gcc instead of VC++.
I downloaded the SDL development libraries (SDL-devel-
1.2.5a-mingw32.tar.gz) and copied them to my MinGW Folder.

To compile my game I use:
g++ -I c:/Programme/MinGW/include/Sdl -L c:/Programme/MinGW/lib -
lmingw32 -lSDLmain -lSDL mapeditor.cc -o mapeditor.exe -Wall

But it does not work.I get undefined reference for the SDL functions!
In Linux I can compile the same sourcecode!
The include and lib folders are also in my PATH variable in the
autoexec.bat

Can somebody help me?–
Ioan-Tudor Parvulescu <@Ioan-Tudor_Parvulesc>
www.itpsoft.de

Ioan-Tudor Parvulescu wrote:

Hi,

I want to compile my game now with gcc instead of VC++.
I downloaded the SDL development libraries (SDL-devel-
1.2.5a-mingw32.tar.gz) and copied them to my MinGW Folder.

To compile my game I use:
g++ -I c:/Programme/MinGW/include/Sdl -L c:/Programme/MinGW/lib -
lmingw32 -lSDLmain -lSDL mapeditor.cc -o mapeditor.exe -Wall

But it does not work.I get undefined reference for the SDL functions!
In Linux I can compile the same sourcecode!
The include and lib folders are also in my PATH variable in the
autoexec.bat

Can somebody help me?

Firstly, understand that MinGW and Cygwin are, for different reasons,
simply a bitch. But, that is pretty much my compile line. Make sure you
have the files placed correctly:

/usr/include/SDL --> All the SDL headers
/usr/lib/ -->libSDL.a, libSDL.la, libSDLmain.
program directory --> SDL.dll

Firstly, understand that MinGW and Cygwin are, for different > >reasons,
simply a bitch. But, that is pretty much my compile line. Make sure >you
have the files placed correctly:

/usr/include/SDL --> All the SDL headers
/usr/lib/ -->libSDL.a, libSDL.la, libSDLmain.
program directory --> SDL.dll

yes but I want to compile my game unter windows. Under windows I do
not have /usr/*–
Ioan-Tudor Parvulescu <@Ioan-Tudor_Parvulesc>
www.itpsoft.de

get msys, i use mingw in windows with msys and do not use cygwin.

msys is a unix style prompt that gives you /usr/ /bin/ etc.

its great, and works for me painlessly.> ----- Original Message -----

From: ioan@itpsoft.de (Ioan-Tudor Parvulescu)
To:
Sent: Sunday, February 09, 2003 9:18 AM
Subject: Re: [SDL] Re: Compiling SDL Game under Windows with MinGW

Firstly, understand that MinGW and Cygwin are, for different > >reasons,
simply a bitch. But, that is pretty much my compile line. Make sure >you
have the files placed correctly:

/usr/include/SDL --> All the SDL headers
/usr/lib/ -->libSDL.a, libSDL.la, libSDLmain.
program directory --> SDL.dll

yes but I want to compile my game unter windows. Under windows I do
not have /usr/*


Ioan-Tudor Parvulescu
www.itpsoft.de


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

Am 9 Feb 2003 um 9:35 hat Atrix Wolfe geschrieben:

get msys, i use mingw in windows with msys and do not use cygwin.

msys is a unix style prompt that gives you /usr/ /bin/ etc.

its great, and works for me painlessly.

yeah I tried it with msys, but I get the same error and I also don`t
like that solution. :-(–
Ioan-Tudor Parvulescu <@Ioan-Tudor_Parvulesc>
www.itpsoft.de

Hi,

I want to compile my game now with gcc instead of VC++.
I downloaded the SDL development libraries (SDL-devel-
1.2.5a-mingw32.tar.gz) and copied them to my MinGW Folder.

To compile my game I use:
g++ -I c:/Programme/MinGW/include/Sdl -L c:/Programme/MinGW/lib -
lmingw32 -lSDLmain -lSDL mapeditor.cc -o mapeditor.exe -Wall

Try adding the libraries after your source code. The link order matters!
e.g.
g++ mapeditor.cc -o mapeditor.exe -Wall -I c:/Programme/MinGW/include/Sdl -L c:/Programme/MinGW/lib -lmingw32 -lSDLmain -lSDL

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Try adding the libraries after your source code. The link order >matters!
e.g.
g++ mapeditor.cc -o mapeditor.exe -Wall -I >c:/Programme/MinGW/include/Sdl -L c:/Programme/MinGW/lib -lmingw32 ->lSDLmain -lSDL

Thank you very much Sam!!
Now it works :-)–
Ioan-Tudor Parvulescu <@Ioan-Tudor_Parvulesc>
www.itpsoft.de

g++ -c main.cpp -o main.o -I"C:/mingw/include/SDL"

g++ main.o test1_private.res -o
"test1.exe" -L"C:/mingw/lib/SDL" -lmingw32 -lSDLmain -lSDL -mwindows

You’ll have to translate for your Include directory and Lib directory, as
well as filenames.
I recommend downloading and using Dev-C++, which includes MingW - BUT you’ll
have to include those params on every project.

Check out Marius’ tutorial from the SDL Tutorials page for more on that.

Or search the archives for my first post about 2 weeks ago.> ----- Original Message -----

From: ioan@itpsoft.de (Ioan-Tudor Parvulescu)
To:
Sent: Sunday, February 09, 2003 11:18 AM
Subject: Re: [SDL] Re: Compiling SDL Game under Windows with MinGW

Firstly, understand that MinGW and Cygwin are, for different > >reasons,
simply a bitch. But, that is pretty much my compile line. Make sure >you
have the files placed correctly:

/usr/include/SDL --> All the SDL headers
/usr/lib/ -->libSDL.a, libSDL.la, libSDLmain.
program directory --> SDL.dll

yes but I want to compile my game unter windows. Under windows I do
not have /usr/*


Ioan-Tudor Parvulescu
www.itpsoft.de


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