SDL on MinGW -- problem with SDLMain and WinMain()

On to a new project now, and the team wants to make sure that all our code compiles on GCC, so I went to good old MinGW. I followed all the instructions on http://www.libsdl.org/extras/win32/mingw32/README.txt, and everything went great – but I’ve ran into one problem. I’m compiling with both libsdl.a and libsdlmain.a, but GCC is still giving me grief about WinMain() not being defined. I’ve managed to fix the problem by compiling sdlmain.c straight-up into an object file and compiling that into the executable, but it seems a bit odd that this is what is nessecery to get SDL to work under MinGW. Has anyone seen this problem before, or should I just start over and re-install SDL and MinGW and see if it’s something weird about my sorta patch-together configuration? Does anyone know of any way to fix it?—
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.541 / Virus Database: 335 - Release Date: 11/14/2003

i use mingw and it works great for me.

i attached a sample makefile, i hope it helps! (:----- Original Message -----
From: John Silicon
To: sdl at libsdl.org
Sent: Wednesday, November 26, 2003 7:46 PM
Subject: [SDL] SDL on MinGW – problem with SDLMain and WinMain()

On to a new project now, and the team wants to make sure that all our code compiles on GCC, so I went to good old MinGW. I followed all the instructions on http://www.libsdl.org/extras/win32/mingw32/README.txt, and everything went great – but I’ve ran into one problem. I’m compiling with both libsdl.a and libsdlmain.a, but GCC is still giving me grief about WinMain() not being defined. I’ve managed to fix the problem by compiling sdlmain.c straight-up into an object file and compiling that into the executable, but it seems a bit odd that this is what is nessecery to get SDL to work under MinGW. Has anyone seen this problem before, or should I just start over and re-install SDL and MinGW and see if it’s something weird about my sorta patch-together configuration? Does anyone know of any way to fix it?


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.541 / Virus Database: 335 - Release Date: 11/14/2003
-------------- next part --------------
A non-text attachment was scrubbed…
Name: Makefile
Type: application/octet-stream
Size: 198 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20031126/e03a405d/attachment.obj

Hrmmm… Adding those flags to my command line just gives these errors:
g++.exe: shell: No such file or directory
g++.exe: sdl-config: No such file or directory
This happens for both running g++ from the command line, and if I just whip up a small makefile for it. Did I do something wrong?----- Original Message -----
From: Alan Wolfe
To: sdl at libsdl.org
Sent: Wednesday, November 26, 2003 9:10 PM
Subject: Re: [SDL] SDL on MinGW – problem with SDLMain and WinMain()

i use mingw and it works great for me.

i attached a sample makefile, i hope it helps! (:

----- Original Message ----- 
From: John Silicon 
To: sdl at libsdl.org 
Sent: Wednesday, November 26, 2003 7:46 PM
Subject: [SDL] SDL on MinGW -- problem with SDLMain and WinMain()


On to a new project now, and the team wants to make sure that all our code compiles on GCC, so I went to good old MinGW.  I followed all the instructions on http://www.libsdl.org/extras/win32/mingw32/README.txt, and everything went great -- but I've ran into one problem.  I'm compiling with both libsdl.a and libsdlmain.a, but GCC is still giving me grief about WinMain() not being defined.  I've managed to fix the problem by compiling sdlmain.c straight-up into an object file and compiling that into the executable, but it seems a bit odd that this is what is nessecery to get SDL to work under MinGW.  Has anyone seen this problem before, or should I just start over and re-install SDL and MinGW and see if it's something weird about my sorta patch-together configuration?  Does anyone know of any way to fix it?



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.541 / Virus Database: 335 - Release Date: 11/14/2003

John Silicon wrote:

Hrmmm… Adding those flags to my command line just gives these errors:
g++.exe: shell: No such file or directory
g++.exe: sdl-config: No such file or directory
This happens for both running g++ from the command line, and if I just
whip up a small makefile for it. Did I do something wrong?

Look into your mingw/bin path. There should be g++.exe and/or
mingw32-g++.exe.
The error message no such file or directory means:

  1. g++.exe is not in your PATH environment. Add the mingw/bin path to
    the PATH envinmaent variable.
  2. g++.exe does not exist but mingw32-g++.exe change g++.exe to
    mingw32-g++.exe in your makefile.

HTH,

Adib.

You misread. g++ is giving the message that the files “shell” and
"sdl-config" don’t exist
.> ----- Original Message -----

From: taraben.a@wige-data.de (Adib Taraben)
To:
Sent: Thursday, November 27, 2003 1:48 AM
Subject: Re: [SDL] SDL on MinGW – problem with SDLMain and WinMain()

John Silicon wrote:

Hrmmm… Adding those flags to my command line just gives these errors:
g++.exe: shell: No such file or directory
g++.exe: sdl-config: No such file or directory
This happens for both running g++ from the command line, and if I just
whip up a small makefile for it. Did I do something wrong?

Look into your mingw/bin path. There should be g++.exe and/or
mingw32-g++.exe.
The error message no such file or directory means:

  1. g++.exe is not in your PATH environment. Add the mingw/bin path to
    the PATH envinmaent variable.
  2. g++.exe does not exist but mingw32-g++.exe change g++.exe to
    mingw32-g++.exe in your makefile.

HTH,

Adib.


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


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.541 / Virus Database: 335 - Release Date: 11/14/2003

You misread. g++ is giving the message that the files “shell” and
"sdl-config" don’t exist

Obviously one of you is running mingw from the MSYS environment and the other isn’t.

I think – but could be wrong – that most people don’t use MSYS and as such don’t have access to bash/autoconfig and the like, as your failure suggests.

To build SDL I think you’ll need to be running in MSYS (Sam would know for sure), but when you have the SDL.dll and libs you don’t need to use MSYS to compile your actual software that is using SDL.

So it’s to different things; is the goal to compile SDL, or is the goal to compile a software using SDL. I compile using mingw outside the MSYS environment by using the flags “-lmingw32 -lSDLmain -lSDL -mwindows” and linking against the SDL.dll. Works nicely.On Thu, 27 Nov 2003 03:35:02 -0700, John Silicon wrote:

ahhh that makes sense…i figured he had msys.

i tried sdl with dev-c++ a year or more ago and couldnt get it to do the
sdl-config stuff so i got msys which is a bash style prompt for windows that
supports make and some other stuff.

I like msys cause it makes programming in windows alot like what its like
programming in bsd or linux etc so it means less work to get it to work in
the various OS’s.

if your interested you can download msys here:

http://sourceforge.net/project/showfiles.php?group_id=2435> ----- Original Message -----

From: eddy@klopper.net (Eddy L O Jansson)
To:
Sent: Thursday, November 27, 2003 4:43 AM
Subject: Re: [SDL] SDL on MinGW – problem with SDLMain and WinMain()

On Thu, 27 Nov 2003 03:35:02 -0700, John Silicon wrote:

You misread. g++ is giving the message that the files “shell” and
"sdl-config" don’t exist

Obviously one of you is running mingw from the MSYS environment and the
other isn’t.

I think – but could be wrong – that most people don’t use MSYS and as
such don’t have access to bash/autoconfig and the like, as your failure
suggests.

To build SDL I think you’ll need to be running in MSYS (Sam would know
for sure), but when you have the SDL.dll and libs you don’t need to use MSYS
to compile your actual software that is using SDL.

So it’s to different things; is the goal to compile SDL, or is the goal
to compile a software using SDL. I compile using mingw outside the MSYS
environment by using the flags “-lmingw32 -lSDLmain -lSDL -mwindows” and
linking against the SDL.dll. Works nicely.


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

The $(shell bla) command is expanded by make to a shell command executing bla.
If you want to add this to the command line, simply add bla (in back-ticks)
instead of the whole expression, e.g.
g++.exe -c test.cpp sdl-config --cflags.

See here:
http://www.libsdl.org/faq.php?action=listentries&category=3#21

Regards,
JohannesAm Donnerstag 27 November 2003 05:47 schrieb John Silicon:

Hrmmm… Adding those flags to my command line just gives these errors:
g++.exe: shell: No such file or directory
g++.exe: sdl-config: No such file or directory
This happens for both running g++ from the command line, and if I just whip
up a small makefile for it. Did I do something wrong?

Hmm, I should read both, the wohle thread and the whole message before
answering … :)Am Donnerstag 27 November 2003 17:57 schrieb Johannes Schmidt:

Am Donnerstag 27 November 2003 05:47 schrieb John Silicon:

Hrmmm… Adding those flags to my command line just gives these errors:
g++.exe: shell: No such file or directory
g++.exe: sdl-config: No such file or directory
This happens for both running g++ from the command line, and if I just
whip up a small makefile for it. Did I do something wrong?

The $(shell bla) command is expanded by make to a shell command executing
bla. If you want to add this to the command line, simply add bla (in
back-ticks) instead of the whole expression, e.g.
g++.exe -c test.cpp sdl-config --cflags.

See here:
http://www.libsdl.org/faq.php?action=listentries&category=3#21

Make sure you use the windows subsystem, ie add “-mwindows” to the mingw flags.

John Silicon wrote:> On to a new project now, and the team wants to make sure that all our

code compiles on GCC, so I went to good old MinGW. I followed all the
instructions on http://www.libsdl.org/extras/win32/mingw32/README.txt,
and everything went great – but I’ve ran into one problem. I’m
compiling with both libsdl.a and libsdlmain.a, but GCC is still giving
me grief about WinMain() not being defined. I’ve managed to fix the
problem by compiling sdlmain.c straight-up into an object file and
compiling that into the executable, but it seems a bit odd that this is
what is nessecery to get SDL to work under MinGW. Has anyone seen this
problem before, or should I just start over and re-install SDL and MinGW
and see if it’s something weird about my sorta patch-together
configuration? Does anyone know of any way to fix it?


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.541 / Virus Database: 335 - Release Date: 11/14/2003