Installing SDL with mingw, but no "/home/hercules/"

Hi,

I’m completely new to SDL and this group and have a question
concerning the installation process of SDL on WinOS with mingw.

I use mingw with gcc 3.2.3, msys 1.0 and I have downloaded
SDL-devel-1.2.7-mingw32.tar.gz.

I found the makefile, started it and saw, that I had to edit it
a little bit (what seemed very strange to me and I guess this
was the start of my error), but I did it and at the end I succeeded:

What I edited:
CWD := $(shell pwd) —> CWD := $(pwd) ### I have no “shell” on WinOS

new:
cp = c:/msys/1.0/bin/cp
mv = c:/msys/1.0/bin/mv

and:
make install-sdl prefix=/usr/localmake —> make install-sdl
prefix=c:/mingw
### there is no /usr/localmake on my system

After that, “make mingw” finished without error and the headers,
libs and the sdl.dll where all at their right places (as I assume).

(I only have a bad feeling, because this makefile has been
intended to be used with mingw, but why doesn’t it originally run on my
system?)

I took a small testfile, which I found anywhere:
// =============================================
#include <stdlib.h>
#include “SDL/SDL.h”

int main()
{
if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
fprintf(stderr, “SDL konnte nicht initialisiert werden:
%s\n”, SDL_GetError());
exit(1);
}

atexit(SDL_Quit);

}
// ============================

…and linked it with “-lmingw32 -lSDLmain -lSDL -mwindows” (as it was
adviced at
several places) and got the following error:

c:/mingw/bin/…/lib/gcc-lib/mingw32/3.2.3/…/…/…/libSDLmain.a(SDL_main.o.b)(.text+0x307):
In function console_main': /home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:227: undefined reference toSDL_main’
mingw32-make.exe: *** [sdl_1.exe] Error 1

Sorry, I have no idea, from what that comes: “/home/hercules/” on a windows
system ???

Is there anybody, who can help me, please?
I’m sure, that hundreds of people had successfully installed SDL with mingw
and there has to be only a silly trick, what I had forgotten …

Thanks for any hints

Gerhard

int main()
{
if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
fprintf(stderr, “SDL konnte nicht initialisiert werden:
%s\n”, SDL_GetError());
exit(1);
}

atexit(SDL_Quit);

}
// ============================

…and linked it with “-lmingw32 -lSDLmain -lSDL -mwindows” (as it was
adviced at
several places) and got the following error:

c:/mingw/bin/…/lib/gcc-lib/mingw32/3.2.3/…/…/…/libSDLmain.a(SDL_main.o.b)(.text+0x307):

In function console_main': /home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:227: undefined reference toSDL_main’
mingw32-make.exe: *** [sdl_1.exe] Error 1

I don’t know about the rest of your problem, but from what I remember linking
with SDLmain provides a main function that wraps around a main function you
supply (called SDL_main). If you supply your own main function it’s my belief
that you shouldn’t link with SDLmain, only SDL.

[…]

I took a small testfile, which I found anywhere:
// =============================================
#include <stdlib.h>
#include “SDL/SDL.h”

int main()
{
[…]
c:/mingw/bin/…/lib/gcc-lib/mingw32/3.2.3/…/…/…/libSDLmain.a(SDL_main.o.
b)(.text+0x307): In function console_main': /home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:227: undefined reference toSDL_main’
mingw32-make.exe: *** [sdl_1.exe] Error 1

Try replacing your
"int main()“
with
"int main(int argc, char ** argv)”

The SDL main library does some WinMain magic on Windows and calls your main
functions. Therefore, your main functions should look like the one above.

Regards,
JohannesAm Donnerstag 06 Mai 2004 16:32 schrieb Gerhard Herbig: