Link error under windows

When I compile the tests of the sdl under windows. The following errors occurs:

--------------------Configuration: test - Debug--------------------
Compiling source file(s)…
testevent.c
Linking…
C:\mingw\lib\libmingw32.a(main.o)(.text+0x97):main.c: undefined reference to `WinMain at 16’

test.exe - 1 error(s), 0 warning(s)

I use mingw and gcc 3.2.3. I link my program with libmingw32.a, libsdl.a and libsdlmain.a, and I use -mwindows while compiling and linking. Who can tell me what’s wrong with it?

Any chance you’re using MinGW Developer Studio (the output just looks like
it is all)?

If so, what is the Libraries test under the Link tab of your project options
(Debug Cfg.)
If not, do you have the makefile, and could you paste the gcc/g++
compilation line for main.o, and/or the final executable?

  • Silicon> ----- Original Message -----

From: lhuang@sei.xjtu.edu.cn (huangliang)
To:
Sent: Sunday, December 14, 2003 1:07 AM
Subject: [SDL] Link error under windows

When I compile the tests of the sdl under windows. The following errors
occurs:

--------------------Configuration: test - Debug--------------------
Compiling source file(s)…
testevent.c
Linking…
C:\mingw\lib\libmingw32.a(main.o)(.text+0x97):main.c: undefined reference
to `WinMain at 16’

test.exe - 1 error(s), 0 warning(s)

I use mingw and gcc 3.2.3. I link my program with libmingw32.a, libsdl.a
and libsdlmain.a, and I use -mwindows while compiling and linking. Who can
tell me what’s wrong with it?H2j)? ??.X?????? ???f?f?X?)??


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.547 / Virus Database: 340 - Release Date: 12/2/2003

I’ve been getting the same problem!
Hopefully we’ll both get an answer. :slight_smile:

Linz.> ----- Original Message -----

From: lhuang@sei.xjtu.edu.cn (huangliang)
Newsgroups: gmane.comp.lib.sdl
Sent: Sunday, December 14, 2003 8:07 AM
Subject: Link error under windows

When I compile the tests of the sdl under windows. The following errors
occurs:

--------------------Configuration: test - Debug--------------------
Compiling source file(s)…
testevent.c
Linking…
C:\mingw\lib\libmingw32.a(main.o)(.text+0x97):main.c: undefined reference
to `WinMain at 16’

test.exe - 1 error(s), 0 warning(s)

I use mingw and gcc 3.2.3. I link my program with libmingw32.a, libsdl.a
and libsdlmain.a, and I use -mwindows while compiling and linking. Who can
tell me what’s wrong with it?

huangliang wrote:

When I compile the tests of the sdl under windows. The following errors
occurs:

--------------------Configuration: test - Debug--------------------
Compiling source file(s)…
testevent.c
Linking…
C:\mingw\lib\libmingw32.a(main.o)(.text+0x97):main.c: undefined reference
to `WinMain at 16’

test.exe - 1 error(s), 0 warning(s)

I use mingw and gcc 3.2.3. I link my program with libmingw32.a, libsdl.a
and libsdlmain.a, and I use -mwindows while compiling and linking. Who can
tell me what’s wrong with it?

have you got main written in full? i.e.
int main(int argc, char *argv[])

also you need to link sdlmain before sdl.
found this after a couple of googles:
http://www.spacejack.org/games/mingw/mingw-sdl.html

Both of us should have a look at the FAQs which is on
http://www.libsdl.org/faq.php?action=listentries&category=4#58 for a long time.
: -)> ----- Original Message -----

From: dindsaymusic@fujiyama.newnet.co.uk (Lindsay Edwards)
To:
Sent: Monday, December 15, 2003 2:25 AM
Subject: [SDL] Re: Link error under windows

I’ve been getting the same problem!
Hopefully we’ll both get an answer. :slight_smile:

Linz.
----- Original Message -----
From: “huangliang” <@huangliang>
Newsgroups: gmane.comp.lib.sdl
Sent: Sunday, December 14, 2003 8:07 AM
Subject: Link error under windows

When I compile the tests of the sdl under windows. The following errors
occurs:

--------------------Configuration: test - Debug--------------------
Compiling source file(s)…
testevent.c
Linking…
C:\mingw\lib\libmingw32.a(main.o)(.text+0x97):main.c: undefined reference
to `WinMain at 16’

test.exe - 1 error(s), 0 warning(s)

I use mingw and gcc 3.2.3. I link my program with libmingw32.a, libsdl.a
and libsdlmain.a, and I use -mwindows while compiling and linking. Who can
tell me what’s wrong with it?