MinGW and SDL

Hi,
I have been trying to get my SDL application to compile and run under
MinGW, it currently already runs on Mac OS X and Linux.

I downloaded the SDL binaries for MinGW and I compiled smpeg and
SDL_Mixer from source. All this went pretty smoothy and after a
little bit of pokery my own app compiled too…

It doesn’t however run… I get the error “The application failed to
initialize properly (0xc0000005). Click on OK to terminate the
application.”

I have posted a thread to the MinGW users alias and I have been told
that it is most likely a library initialization problem… The first
line of my main() function isn’t even reached.

I am really stuck as to what could be going wrong. Is anyone familiar
with this error? Googling for it hasn’t been very helpful.–
Paul Richards

I am convinced that the problem (I’ve had it too) is that the DLLs don’t
compile properly. The libraries do though, so if you “borrow” the DLLs
built under VC6/7, everything should work fine.

-TomT64

Paul Richards wrote:>Hi,

I have been trying to get my SDL application to compile and run under
MinGW, it currently already runs on Mac OS X and Linux.

I downloaded the SDL binaries for MinGW and I compiled smpeg and
SDL_Mixer from source. All this went pretty smoothy and after a
little bit of pokery my own app compiled too…

It doesn’t however run… I get the error “The application failed to
initialize properly (0xc0000005). Click on OK to terminate the
application.”

I have posted a thread to the MinGW users alias and I have been told
that it is most likely a library initialization problem… The first
line of my main() function isn’t even reached.

I am really stuck as to what could be going wrong. Is anyone familiar
with this error? Googling for it hasn’t been very helpful.

I have just noticed that my reply to this message ended up going just
to Tom and not back to the list…

I tried Tom’s suggestion and I found that the VC6 compiled dlls made
no difference, they were infact identical in size to the MinGW ones.

On my way to stripping down my app to finding out which lib in
particular was causing the grief I found that it was SDL_Mixer. I
find that quite odd because it shows that my SDL is completely fine
(my gfx still worked) and that somehow compiling SDL_Mixer from source
against it doesn’t work…

Could anyone point out to me what could be wrong?On Fri, 18 Jun 2004 20:14:41 -0700, TomT64 wrote:

I am convinced that the problem (I’ve had it too) is that the DLLs don’t
compile properly. The libraries do though, so if you “borrow” the DLLs
built under VC6/7, everything should work fine.

-TomT64

Paul Richards wrote:

Hi,
I have been trying to get my SDL application to compile and run under
MinGW, it currently already runs on Mac OS X and Linux.

I downloaded the SDL binaries for MinGW and I compiled smpeg and
SDL_Mixer from source. All this went pretty smoothy and after a
little bit of pokery my own app compiled too…

It doesn’t however run… I get the error “The application failed to
initialize properly (0xc0000005). Click on OK to terminate the
application.”

I have posted a thread to the MinGW users alias and I have been told
that it is most likely a library initialization problem… The first
line of my main() function isn’t even reached.

I am really stuck as to what could be going wrong. Is anyone familiar
with this error? Googling for it hasn’t been very helpful.


Paul Richards

for what it’s worth ive made dlls under mingw lots of times without
problems.

Paul: not really related to your problem but if you dont have it you might
think about getting msys, a bash style prompt for windows. you can do
configure, make etc in there, so getting things even more cross platform
compilable is super easy (:> ----- Original Message -----

From: tomt64@users.sf.net (TomT64)
To: ; “A list for developers using the SDL library.
(includes SDL-announce)”
Sent: Friday, June 18, 2004 8:14 PM
Subject: Re: [SDL] MinGW and SDL

I am convinced that the problem (I’ve had it too) is that the DLLs don’t
compile properly. The libraries do though, so if you “borrow” the DLLs
built under VC6/7, everything should work fine.

-TomT64

Paul Richards wrote:

Hi,
I have been trying to get my SDL application to compile and run under
MinGW, it currently already runs on Mac OS X and Linux.

I downloaded the SDL binaries for MinGW and I compiled smpeg and
SDL_Mixer from source. All this went pretty smoothy and after a
little bit of pokery my own app compiled too…

It doesn’t however run… I get the error “The application failed to
initialize properly (0xc0000005). Click on OK to terminate the
application.”

I have posted a thread to the MinGW users alias and I have been told
that it is most likely a library initialization problem… The first
line of my main() function isn’t even reached.

I am really stuck as to what could be going wrong. Is anyone familiar
with this error? Googling for it hasn’t been very helpful.


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

Yeah I set up SDL and SDL_Mixer for use in MinGW a couple of years ago
and never remember having a single problem… This is a new
installation and problems are comming up all over the place.

I actually have my MinGW installed together with MSYS. I agree, the
two together make Windows a much friendlier place to work… :)On Sat, 19 Jun 2004 02:49:42 -0700, Alan Wolfe wrote:

for what it’s worth ive made dlls under mingw lots of times without
problems.

Paul: not really related to your problem but if you dont have it you might
think about getting msys, a bash style prompt for windows. you can do
configure, make etc in there, so getting things even more cross platform
compilable is super easy (:

----- Original Message -----
From: “TomT64”
To: ; “A list for developers using the SDL library.
(includes SDL-announce)”
Sent: Friday, June 18, 2004 8:14 PM
Subject: Re: [SDL] MinGW and SDL

I am convinced that the problem (I’ve had it too) is that the DLLs don’t
compile properly. The libraries do though, so if you “borrow” the DLLs
built under VC6/7, everything should work fine.

-TomT64

Paul Richards wrote:

Hi,
I have been trying to get my SDL application to compile and run under
MinGW, it currently already runs on Mac OS X and Linux.

I downloaded the SDL binaries for MinGW and I compiled smpeg and
SDL_Mixer from source. All this went pretty smoothy and after a
little bit of pokery my own app compiled too…

It doesn’t however run… I get the error “The application failed to
initialize properly (0xc0000005). Click on OK to terminate the
application.”

I have posted a thread to the MinGW users alias and I have been told
that it is most likely a library initialization problem… The first
line of my main() function isn’t even reached.

I am really stuck as to what could be going wrong. Is anyone familiar
with this error? Googling for it hasn’t been very helpful.


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


Paul Richards

Paul Richards wrote:

It doesn’t however run… I get the error “The application failed to
initialize properly (0xc0000005). Click on OK to terminate the
application.”

Any new ideas on this subject? I’m now getting this error as well. I’m
cross-compiling on Mac OS X, and the app runs fine as long as it only
uses SDL and SDL_image, but as soon as I use a function from SDL_ttf, I
get that error message when I try to start it (interestingly, I get it
twice). I don’t think that my SDL_ttf.dll (also cross-compiled) is
broken, because the ‘showfont’ sample program runs just fine with it.

-Christian

Christian Walther wrote:

Paul Richards wrote:

It doesn’t however run… I get the error “The application failed to
initialize properly (0xc0000005). Click on OK to terminate the
application.”

Any new ideas on this subject? I’m now getting this error as well. I’m
cross-compiling on Mac OS X, and the app runs fine as long as it only
uses SDL and SDL_image, but as soon as I use a function from SDL_ttf,
I get that error message when I try to start it (interestingly, I get
it twice). I don’t think that my SDL_ttf.dll (also cross-compiled) is
broken, because the ‘showfont’ sample program runs just fine with it.

Your development setup is quite strange, so very few people can hope to
reproduce :slight_smile: But if you have a small source code demonstrating the
problem, maybe people around here can take a look at it to determine if
the problem comes from your code or from your devel env.

Stephane

I wrote:

I don’t think that my SDL_ttf.dll (also cross-compiled) is
broken, because the ‘showfont’ sample program runs just fine with it.

I spoke too soon - it seems that it’s indeed the dll that’s broken, as
my program works with the SDL_ttf.dll downloaded from libsdl.org. Strange.

-Christian

Stephane Marchesin wrote:

Your development setup is quite strange, so very few people can hope to
reproduce :slight_smile:

As far as I know, I’m not the only one around here cross-compiling for
Windows on Mac OS X. And it seems that the problem is in Mingw, since
people seem to have it on Linux and Windows as well.

But if you have a small source code demonstrating the
problem, maybe people around here can take a look at it to determine if
the problem comes from your code or from your devel env.

The problem is that the small source codes I have tried so far do not
exhibit the problem…

Anyway, I found that - contrary to my expectations - I can work around
the problem by using the precompiled SDL_ttf.dll from libsdl.org. But it
would still be nice if someone figured out what exactly the problem is
some time…

-Christian

Perhaps someone should invite MinGW developers to help
find the solution? Given what you’ve said so far,
there is either a problem in the cross-compiling
process, or in MinGW itself. I wish I knew more about
cross-compiling, but even when I was working on a
project that was cross-compiling from Windows to
Gameboy Advance, I was far displaced from the
development environment’s configuration, and know very
little about it.

Is there a webpage somewhere to introduce a programmer
to cross-compiling between various operating systems
(or specific ones?) I’d like to learn. When I get my
other two machines back from the police, I don’t know
if it will still contain my cracked version of Visual
Studio, if it doesn’t, I’ll be looking for a new build
environment! (Just in case someone wants to help me
out, I will at that point have 3 machines, running
Panther, XP, and Linux 2.4, thanks in advance!)

— Christian Walther wrote:> Stephane Marchesin wrote:

Your development setup is quite strange, so very
few people can hope to
reproduce :slight_smile:

As far as I know, I’m not the only one around here
cross-compiling for
Windows on Mac OS X. And it seems that the problem
is in Mingw, since
people seem to have it on Linux and Windows as well.

But if you have a small source code demonstrating
the
problem, maybe people around here can take a look
at it to determine if
the problem comes from your code or from your
devel env.

The problem is that the small source codes I have
tried so far do not
exhibit the problem…

Anyway, I found that - contrary to my expectations -
I can work around
the problem by using the precompiled SDL_ttf.dll
from libsdl.org. But it
would still be nice if someone figured out what
exactly the problem is
some time…

-Christian


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


Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

Hi there,

I am trying to compile an application in MinGW with MSYS and GCC 4.4.0. When linking the libraries to the appliation I get the following error:

Code:
/bin/sh …/…/libtool --mode=link --tag=CXX g++ -g -O2 -IE:/msys/1.0/local/incl
ude -IE:/msys/1.0/local/include/CEGUI -DOGRE_GUI_WIN32 -DOGRE_THREAD_SUPPORT=2
-mthreads -DOGRE_CONFIG_LITTLE_ENDIAN -IE:/msys/1.0/local/include -IE:/msys/1.0
/local/include/OGRE -I/usr/local/include/boost-1_40 -IE:/msys/1.0/local/include/
CEGUI -IE:/msys/1.0/local/include -DLUA51 -IE:/msys/1.0/local/include -IE:
/msys/1.0/local/include -IE:/msys/1.0/local/include/sigc+±2.0 -IE:/msys/1.0/l
ocal/lib/sigc+±2.0/include -IE:/msys/1.0/local/include/Eris-1.3 -IE:/msys/1.0
/local/include/sigc+±2.0 -IE:/msys/1.0/local/lib/sigc+±2.0/include -IE:/msys/1
.0/local/include/skstream-0.3 -IE:/msys/1.0/local/lib/skstream-0.3/include -IE:/
msys/1.0/local/include/Atlas-C+±0.6 -IE:/msys/1.0/local/include/wfmath-0.3 -IE:
/msys/1.0/local/include/Mercator-0.2 -IE:/msys/1.0/local/include/varconf-1.0 -IE
:/msys/1.0/local/include/libwfut-0.2 -IE:/msys/1.0/local/include -DNDEBUG -I/u
sr/local/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -lboost_thread-gcc44 -o em
ber.bin.exe -Wl …/…/src/components/ogre/scripting/bindings/lua/helpers/liblua
Helpers.a …/…/src/components/ogre/scripting/bindings/lua/ogre/liblua_Ogre.a .
./…/src/components/ogre/scripting/bindings/lua/liblua_EmberOgre.a …/…/src/mai
n/bindings/lua/liblua_Main.a …/…/src/services/bindings/lua/liblua_EmberService
s.a …/…/src/framework/bindings/lua/atlas/liblua_Atlas.a …/…/src/framework/bi
ndings/lua/eris/liblua_Eris.a …/…/src/framework/bindings/lua/varconf/liblua_Va
rconf.a …/…/src/framework/bindings/lua/liblua_Framework.a …/…/src/components
/ogre/libEmberOgre.a …/…/src/components/ogre/SceneManagers/EmberPagingSceneMan
ager/src/libEmberPagingSceneManager.a …/…/src/components/ogre/environment/cael
um/libCaelum.a …/…/src/components/ogre/environment/pagedgeometry/libpagedgeome
try.a …/…/src/components/ogre/environment/meshtree/libMeshTree.a …/…/src/com
ponents/entitymapping/libEntityMapping.a …/…/src/components/lua/libLua.a …/…
/src/services/libServices.a …/…/src/services/config/libConfigService.a …/…/s
rc/services/input/libInputService.a …/…/src/services/logging/libLoggingService
.a …/…/src/services/metaserver/libMetaserverService.a …/…/src/services/scrip
ting/libScriptingService.a …/…/src/services/server/libServerService.a …/…/sr
c/services/sound/libSoundService.a …/…/src/services/time/libTime.a …/…/src/s
ervices/wfut/libWfut.a …/…/src/extensions/libExtensions.a …/…/src/framework/
tasks/libTasks.a …/…/src/framework/libFramework.a -lCEGUILuaScriptModule -lCEG
UItoluapp -lshlwapi -LE:/msys/1.0/local/lib -lCEGUIBase -lwinmm -LE:/msys/1.0
/local/lib -L/usr/local/lib -lCEGUIOgreRenderer -lOgreMain -lboost_thread-mgw44-
mt-1_41 -lCEGUIBase -lwinmm -LE:/msys/1.0/local/lib -llua -lm -LE:/msys/1.0/
local/lib -lOpenAL32 -LE:/msys/1.0/local/lib -lalut -lOpenAL32 -LE:/msys/1.0
/local/lib -lsigc-2.0 -LE:/msys/1.0/local/lib -leris-1.3 -lskstream-0.3 -lws2

32 -lwsock32 -lvarconf-1.0 -lmercator-0.2 -lAtlasObjects-0.6 -lAtlasNet-0.6 -lAt
lasCodecs-0.6 -lAtlasMessage-0.6 -lAtlas-0.6 -lwfmath-0.3 -lwfut-0.2 -lsigc-2.0
-lcurl -L/usr/local/lib -lmingw32 -lSDLMain -lSDL -mwindows
libtool: link: g++ -g -O2 -IE:/msys/1.0/local/include -IE:/msys/1.0/local/includ
e/CEGUI -DOGRE_GUI_WIN32 -DOGRE_THREAD_SUPPORT=2 -mthreads -DOGRE_CONFIG_LITTLE_
ENDIAN -IE:/msys/1.0/local/include -IE:/msys/1.0/local/include/OGRE -I/usr/local
/include/boost-1_40 -IE:/msys/1.0/local/include/CEGUI -IE:/msys/1.0/local/includ
e -DLUA51 -IE:/msys/1.0/local/include -IE:/msys/1.0/local/include -IE:/msys/1.0/
local/include/sigc+±2.0 -IE:/msys/1.0/local/lib/sigc+±2.0/include -IE:/msys/1.
0/local/include/Eris-1.3 -IE:/msys/1.0/local/include/sigc+±2.0 -IE:/msys/1.0/lo
cal/lib/sigc+±2.0/include -IE:/msys/1.0/local/include/skstream-0.3 -IE:/msys/1.
0/local/lib/skstream-0.3/include -IE:/msys/1.0/local/include/Atlas-C+±0.6 -IE:/
msys/1.0/local/include/wfmath-0.3 -IE:/msys/1.0/local/include/Mercator-0.2 -IE:/
msys/1.0/local/include/varconf-1.0 -IE:/msys/1.0/local/include/libwfut-0.2 -IE:/
msys/1.0/local/include -DNDEBUG -I/usr/local/include/SDL -D_GNU_SOURCE=1 -Dmain=
SDL_main -o ember.bin.exe -Wl -mwindows -lboost_thread-gcc44 …/…/src/componen
ts/ogre/scripting/bindings/lua/helpers/liblua_Helpers.a …/…/src/components/ogr
e/scripting/bindings/lua/ogre/liblua_Ogre.a …/…/src/components/ogre/scripting/
bindings/lua/liblua_EmberOgre.a …/…/src/main/bindings/lua/liblua_Main.a …/…/
src/services/bindings/lua/liblua_EmberServices.a …/…/src/framework/bindings/lu
a/atlas/liblua_Atlas.a …/…/src/framework/bindings/lua/eris/liblua_Eris.a …/…
/src/framework/bindings/lua/varconf/liblua_Varconf.a …/…/src/framework/binding
s/lua/liblua_Framework.a …/…/src/components/ogre/libEmberOgre.a …/…/src/comp
onents/ogre/SceneManagers/EmberPagingSceneManager/src/libEmberPagingSceneManager
.a …/…/src/components/ogre/environment/caelum/libCaelum.a …/…/src/components
/ogre/environment/pagedgeometry/libpagedgeometry.a …/…/src/components/ogre/env
ironment/meshtree/libMeshTree.a …/…/src/components/entitymapping/libEntityMapp
ing.a …/…/src/components/lua/libLua.a …/…/src/services/libServices.a …/…/s
rc/services/config/libConfigService.a …/…/src/services/input/libInputService.a
…/…/src/services/logging/libLoggingService.a …/…/src/services/metaserver/li
bMetaserverService.a …/…/src/services/scripting/libScriptingService.a …/…/sr
c/services/server/libServerService.a …/…/src/services/sound/libSoundService.a
…/…/src/services/time/libTime.a …/…/src/services/wfut/libWfut.a …/…/src/ex
tensions/libExtensions.a …/…/src/framework/tasks/libTasks.a …/…/src/framewor
k/libFramework.a /usr/local/lib/libCEGUILuaScriptModule.a -LE:/msys/1.0/local/li
b /usr/local/lib/libCEGUItoluapp.a -lshlwapi -L/usr/local/lib /usr/local/lib/lib
CEGUIOgreRenderer.a /usr/local/lib/libOgreMain.a -LE:/msys/1.0/local/bin -lzzip
-lCg -lfreeimage -lpthread -lboost_thread-mgw44-mt-1_41 /usr/local/lib/libCEGUIB
ase.a /usr/local/lib/libfreetype.dll.a /usr/local/lib/libpcre.dll.a -lglut32 -lg
lu32 -lopengl32 -llua -lalut -lOpenAL32 /e/work/local/lib/liberis-1.3.a -Le:/wor
k/local/lib /e/work/local/lib/libskstream-0.3.a -lwsock32 /e/work/local/lib/libv
arconf-1.0.dll.a /e/work/local/lib/libmercator-0.2.dll.a /e/work/local/lib/libAt
lasObjects-0.6.dll.a /e/work/local/lib/libAtlasNet-0.6.dll.a /e/work/local/lib/l
ibAtlasCodecs-0.6.dll.a /e/work/local/lib/libAtlasMessage-0.6.dll.a /e/work/loca
l/lib/libAtlas-0.6.dll.a /e/work/local/lib/libwfmath-0.3.dll.a /usr/local/lib/li
bwfut-0.2.a /usr/local/lib/libsigc-2.0.dll.a /usr/local/lib/libcurl.a -lwldap32
-lz -lws2_32 -lmingw32 -lSDLMain /usr/local/lib/libSDL.dll.a -luser32 -lgdi32 -l
winmm -mthreads -L/usr/local/lib -L/e/work/local/lib -L/usr/local/lib -L/e/work/
local/lib
E:/msys/1.0/local/lib/libSDLMain.a(SDL_win32_main.o): In function console_main' : e:\SDL-1.2.14\x86_release/../src/main/win32/SDL_win32_main.c:315: undefined refe rence toSDL_main’
collect2: ld returned 1 exit status
make[4]: *** [ember.bin.exe] Error 1
make[4]: Leaving directory /e/work/ember2/ember/src/main' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory/e/work/ember2/ember/src/main’
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory /e/work/ember2/ember/src' make[1]: *** [all] Error 2 make[1]: Leaving directory/e/work/ember2/ember/src’
make: *** [all-recursive] Error 1

This library was compiled on my system, however using the precompiled one that you give away I get the same error but the difference is the path to the undefined reference.
Do you know who to fix this error?

Thanks in advance,

James

Any help here because I really need this to work.

“jamesl22” writes:

[…]

      -lz -lws2_32 -lmingw32 -lSDLMain /usr/local/lib/libSDL.dll.a -luser32 -lgdi32 -l                                                                                         
      winmm -mthreads -L/usr/local/lib -L/e/work/local/lib -L/usr/local/lib -L/e/work/                                                                                         
      local/lib                                                                                                                                                                
      E:/msys/1.0/local/lib/libSDLMain.a(SDL_win32_main.o): In function `console_main'                                                                                         
      :                                                                                                                                                                        
      e:\SDL-1.2.14\x86_release/../src/main/win32/SDL_win32_main.c:315: undefined refe                                                                                         
      rence to `SDL_main'                                                                                                                                                      

[…]

Could it be the infamous Win32 linking error where main is not exactly
defined as

int main(int argc, char *argv[])

but something else like “void main()”? Try changing it.–
Alberto

Hi,

http://www.libsdl.org/faq.php?action=listentries&category=4#48 the 3
questions from this on.

Hi there,

e:\SDL-1.2.14\x86_release/…/src/main/win32/SDL_win32_main.c:315:
undefined refe
rence to `SDL_main’
collect2: ld returned 1 exit status

did you linked SDLmain in? This will probably help.

This library was compiled on my system, however using the precompiled
one
that you give away I get the same error but the difference is the path
to
the undefined reference.
Do you know who to fix this error?

Christoph Nelles

E-Mail : @Christoph_Nelles
Jabber : eazrael at evilazrael.net ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txtOn Mon, 15 Feb 2010 10:16:48 -0800, “jamesl22” wrote:

I have included SDL.h in the application but that didn’t help. I am definatly linking to -lSDLMain.

Sometimes the order of the linking matters:
I always use the following at the top of my make files.

LIBS = -lmingw32 -mwindows -lSDLmain -lSDL -lopengl32 -lglu32 -lm

hope that helps

JohnOn Tue, Feb 16, 2010 at 3:00 PM, jamesl22 wrote:

I have included SDL.h in the application but that didn’t help. I am
definatly linking to -lSDLMain.

Thanks for he advice but that didn’t help either.

What are the SDL includes in the file containing main()?
What is your main() declaration look like?On Tue, Feb 16, 2010 at 1:00 PM, jamesl22 wrote:

I have included SDL.h in the application but that didn’t help. I am
definatly linking to -lSDLMain.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Here is the main declaration:

Code:
#ifdef __cplusplus
extern “C”
#endif
#include “SDLMain.h”
#include "SDL.h"
int main(int argc, char **argv)
{

I really need this fixed.