SDL 1.2.3 and cygwin under win98

Hi!

I am trying to compile and link a small SDL project using cygwin on my
win98 machine. I am running into problems. Compileing works fine, but
when I try to link using the command below:

gcc -o pong *.o -L/lib/mingw -L/home/brasse/lib/SDL-1.2.3/i386
-mingw32msvc/lib -lstlport_cygwin -lmingw32 -lSDLmain -lSDL -mwindows

I get the following error message:

/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/…/…/…/…/i686-pc-cygwin/bin/ld:
warning: cannot find entry symbol _WinMainCRTStartup; defaulting to 00401000
/home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.b):
In function ShowError': /home/hercules/SDL-1.2.3/src/main/SDL_main.c:119: undefined reference to_imp___iob’
/home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.b):
In function cleanup_output': /home/hercules/SDL-1.2.3/src/main/SDL_main.c:139: undefined reference to_imp___iob’
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:140: undefined reference to
_imp___iob' /home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.b): In functionconsole_main’:
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:227: undefined reference to
SDL_main' /home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.b): In functionWinMain’:
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:265: undefined reference to
_imp___iob' /home/hercules/SDL-1.2.3/src/main/SDL_main.c:272: undefined reference to_imp___iob’
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:276: undefined reference to
_imp___iob' /home/hercules/SDL-1.2.3/src/main/SDL_main.c:283: undefined reference to_imp___iob’
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:287: undefined reference to
_imp___iob' /home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.b):/home/hercules/SDL-1.2.3/src/main/SDL_main.c:288: more undefined references to_imp___iob’ follow
collect2: ld returned 1 exit status

Does anyone know what these _imp___iob things are?

Any help would be greatly appriciated!

Regards,
Mattias

I had this problem also in the beginning but I’ve managed to fix
this in a rather non-standard way.

When I want to compile a WIN32 version of my SDL program and I want
to use console output (which standard is not done but put in the
stdout.txt and stderr.txt files) I use the following in my Makefile:

LIBS = -Dmain=SDL_main -L/lib/mingw -lcygwin -lSDLmain -lSDL -lwinmm
-lmsvcrt -lcrtdll

If I want to use stdout.txt and stderr.txt I use the following :

LIBS = -L/lib/mingw /usr/local/bin/sdl-config --libs -lcrtdll

With the latest Cygwin update I get errors at undefined references with
the CRT DLL so I use -lcrtdll (found in /lib/mingw) which solves it :slight_smile:

Also make sure you compile the sourcefiles using
/usr/local/bin/sdl-config --cflags.

This should work but I can’t garrantee it ofcourse.

Regards,

Niels Wagenaar> -----Oorspronkelijk bericht-----

Van: brasse [mailto:brasse at ludd.luth.se]
Verzonden: zaterdag 16 februari 2002 16:16
Aan: SDL
Onderwerp: [SDL] SDL 1.2.3 and cygwin under win98

Hi!

I am trying to compile and link a small SDL project using
cygwin on my
win98 machine. I am running into problems. Compileing works fine, but
when I try to link using the command below:

gcc -o pong *.o -L/lib/mingw -L/home/brasse/lib/SDL-1.2.3/i386
-mingw32msvc/lib -lstlport_cygwin -lmingw32 -lSDLmain -lSDL -mwindows

I get the following error message:

/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/…/…/…/…/i686-pc-c
ygwin/bin/ld:
warning: cannot find entry symbol _WinMainCRTStartup;
defaulting to 00401000
/home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(S
DL_main.o.b):
In function ShowError': /home/hercules/SDL-1.2.3/src/main/SDL_main.c:119: undefined reference to_imp___iob’
/home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(S
DL_main.o.b):
In function cleanup_output': /home/hercules/SDL-1.2.3/src/main/SDL_main.c:139: undefined reference to_imp___iob’
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:140: undefined
reference to
_imp___iob' /home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(S DL_main.o.b): In functionconsole_main’:
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:227: undefined
reference to
SDL_main' /home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(S DL_main.o.b): In functionWinMain’:
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:265: undefined
reference to
_imp___iob' /home/hercules/SDL-1.2.3/src/main/SDL_main.c:272: undefined reference to_imp___iob’
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:276: undefined
reference to
_imp___iob' /home/hercules/SDL-1.2.3/src/main/SDL_main.c:283: undefined reference to_imp___iob’
/home/hercules/SDL-1.2.3/src/main/SDL_main.c:287: undefined
reference to
_imp___iob' /home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(S DL_main.o.b):/home/hercules/SDL-1.2.3/src/main/SDL_main.c:288: more undefined references to_imp___iob’ follow
collect2: ld returned 1 exit status

Does anyone know what these _imp___iob things are?

Any help would be greatly appriciated!

Regards,
Mattias


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

Hello again!

I added -lcrtdll and that solved almost everything. Now i get this
stange message:

/home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.b):
In function console_main': /home/hercules/SDL-1.2.3/src/main/SDL_main.c:227: undefined reference toSDL_main’
collect2: ld returned 1 exit status
make: *** [pong] Error 1

This is strange for two reasons… 1) /home/hercules does not exist on
my system and 2) I have a SDL_main(int, char**) function in main.cpp
which compiles to main.o.

Any clues? My Makefile is attached.

Regards,
Mattias

nwagenaar at digitaldynamics.nl wrote:

I had this problem also in the beginning but I’ve managed to fix
this in a rather non-standard way.

When I want to compile a WIN32 version of my SDL program and I want
to use console output (which standard is not done but put in the
stdout.txt and stderr.txt files) I use the following in my Makefile:

LIBS = -Dmain=SDL_main -L/lib/mingw -lcygwin -lSDLmain -lSDL -lwinmm
-lmsvcrt -lcrtdll

If I want to use stdout.txt and stderr.txt I use the following :

LIBS = -L/lib/mingw /usr/local/bin/sdl-config --libs -lcrtdll

With the latest Cygwin update I get errors at undefined references with
the CRT DLL so I use -lcrtdll (found in /lib/mingw) which solves it :slight_smile:

Also make sure you compile the sourcefiles using
/usr/local/bin/sdl-config --cflags.

This should work but I can’t garrantee it ofcourse.

Regards,

Niels Wagenaar
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: Makefile
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020216/8789b4b9/attachment.txt

This is strange for two reasons… 1) /home/hercules does not exist on
my system and 2) I have a SDL_main(int, char**) function in main.cpp
which compiles to main.o.

/home/hercules is on Sam’s box, where that object file was compiled, and
thus, the path is stored in the object file.

I haven’t tried this, but the object is there to let you start your
program from a function called “main” instead of “WinMain”. Make sure
you’ve got a main function (not WinMain), and that you’ve got SDL.h
included in that file (is it in SDL.h? I’ve never had trouble, but I’ve
never looked that closely…)

–ryan.

Undo all your tweaks (remove -lcygwin, -lcrtdll, etc.) Instead, add the
following to CFLAGS and LDFLAGS: -mno-cygwin

So your Makefile should look something like:

CFLAGS=$(shell sdl-config --cflags) -mno-cygwin
LDFLAGS=-mnocygwin
LDLIBS=$(shell sdl-config --libs)

main: main.o

main.o: main.c

The start of your program is “main()”, as in a regular C program, not
WinMain or SDL_main.

-Mark!On Sat, 16 Feb 2002, Mattias [ISO-8859-1] Br?ndstr?m wrote:

Hello again!

I added -lcrtdll and that solved almost everything. Now i get this
stange message:

/home/brasse/lib/SDL-1.2.3/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.b):
In function console_main': /home/hercules/SDL-1.2.3/src/main/SDL_main.c:227: undefined reference toSDL_main’
collect2: ld returned 1 exit status
make: *** [pong] Error 1

This is strange for two reasons… 1) /home/hercules does not exist on
my system and 2) I have a SDL_main(int, char**) function in main.cpp
which compiles to main.o.

Any clues? My Makefile is attached.

Regards,
Mattias

nwagenaar at digitaldynamics.nl wrote:

I had this problem also in the beginning but I’ve managed to fix
this in a rather non-standard way.

When I want to compile a WIN32 version of my SDL program and I want
to use console output (which standard is not done but put in the
stdout.txt and stderr.txt files) I use the following in my Makefile:

LIBS = -Dmain=SDL_main -L/lib/mingw -lcygwin -lSDLmain -lSDL -lwinmm
-lmsvcrt -lcrtdll

If I want to use stdout.txt and stderr.txt I use the following :

LIBS = -L/lib/mingw /usr/local/bin/sdl-config --libs -lcrtdll

With the latest Cygwin update I get errors at undefined references with
the CRT DLL so I use -lcrtdll (found in /lib/mingw) which solves it :slight_smile:

Also make sure you compile the sourcefiles using
/usr/local/bin/sdl-config --cflags.

This should work but I can’t garrantee it ofcourse.

Regards,

Niels Wagenaar


Mark K. Kim
http://www.cbreak.org/mark/
PGP key available upon request.

This is kind of confusing. I thougth I was supposed to use SDL_main()
instead of main()… Exactly what functions do I really need to
implement? Both main() and SDL_main()? In that case what should main()
contain? The way I thougth it worked was that main() (and possibly
WinMain) was located in SDLmain.a and that my main() was invoked from
there…

Please explain this to me! =)

Regards,
Mattias

Ryan C. Gordon wrote:> /home/hercules is on Sam’s box, where that object file was compiled, and

thus, the path is stored in the object file.

I haven’t tried this, but the object is there to let you start your
program from a function called “main” instead of “WinMain”. Make sure
you’ve got a main function (not WinMain), and that you’ve got SDL.h
included in that file (is it in SDL.h? I’ve never had trouble, but I’ve
never looked that closely…)

–ryan.


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

This is kind of confusing. I thougth I was supposed to use SDL_main()
instead of main()… Exactly what functions do I really need to
implement? Both main() and SDL_main()? In that case what should main()
contain? The way I thougth it worked was that main() (and possibly
WinMain) was located in SDLmain.a and that my main() was invoked from
there…

Maybe I’m wrong? I thought the point was Unix compatibility (hence main()).

–ryan.

main() gets renamed to SDL_main() automatically by sdl-config passing an
argument to gcc (gcc -Dmain=SDL_main).

-MarkOn Sat, 16 Feb 2002, Ryan C. Gordon wrote:

This is kind of confusing. I thougth I was supposed to use SDL_main()
instead of main()… Exactly what functions do I really need to
implement? Both main() and SDL_main()? In that case what should main()
contain? The way I thougth it worked was that main() (and possibly
WinMain) was located in SDLmain.a and that my main() was invoked from
there…

Maybe I’m wrong? I thought the point was Unix compatibility (hence main()).

–ryan.


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


Mark K. Kim
http://www.cbreak.org/mark/
PGP key available upon request.

Ok… I have attached the the file I am trying to compile and the
Makefile. It would be great if someone could take a look at it. The file
err contains the error messages I am getting.

Thanks in advance!
Mattias

Mark K. Kim wrote:> Undo all your tweaks (remove -lcygwin, -lcrtdll, etc.) Instead, add the

following to CFLAGS and LDFLAGS: -mno-cygwin

So your Makefile should look something like:

CFLAGS=$(shell sdl-config --cflags) -mno-cygwin
LDFLAGS=-mnocygwin
LDLIBS=$(shell sdl-config --libs)

main: main.o

main.o: main.c

The start of your program is “main()”, as in a regular C program, not
WinMain or SDL_main.

-Mark!

I forgot to attach the file…
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdltest.zip
Type: application/x-compressed
Size: 1929 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020217/8c02ecc9/attachment.bin

In your Makefile:

Line 4: “-mnocygwin” should be “-mno-cygwin”

Line 8: “$(LDLIBS)” should come after “main.o”. This is a common
mistake for new users of gcc – the library list should come
after the list of objects.

There are some other minor issues, but the above will do it.

-MarkOn Sun, 17 Feb 2002, Mattias [ISO-8859-1] Br?ndstr?m wrote:

Ok… I have attached the the file I am trying to compile and the
Makefile. It would be great if someone could take a look at it. The file
err contains the error messages I am getting.

Thanks in advance!
Mattias

Mark K. Kim wrote:

Undo all your tweaks (remove -lcygwin, -lcrtdll, etc.) Instead, add the
following to CFLAGS and LDFLAGS: -mno-cygwin

So your Makefile should look something like:

CFLAGS=$(shell sdl-config --cflags) -mno-cygwin
LDFLAGS=-mnocygwin
LDLIBS=$(shell sdl-config --libs)

main: main.o

main.o: main.c

The start of your program is “main()”, as in a regular C program, not
WinMain or SDL_main.

-Mark!


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


Mark K. Kim
http://www.cbreak.org/mark/
PGP key available upon request.