Archived

This topic is now archived and is closed to further replies.

stefu

undefined reference to 'WinMain@16'

Recommended Posts

I need to compile my project from Linux to Windows. It''s not hard task, because I''v used SDL and OpenGL. Everything compiles well, but can''t find out what''s problem withlinking! Undefined reference to ''WinMain@16'' must be very common error :doubt: I have int main(int argc, char *argv[]) in one of my source cpp''s. Could anyone tell from experience the problem is where? I''v already fought with this proble three hours, gotta rest now a little Here something I think might help:
  
#makefile
CC=g++

INCLUDE=-I/usr/include -I/usr/include/freetype2 -L../gamelibrary -L/gcc-2.95.2/i386-mingw32msvc/lib

LIBS= -lgamelibrary -lopengl32 -lglu32 -lSDL -lfreetype 

%.o : %.cpp
	$(CC) $(INCLUDE) -c -o $@ $<

test: test.o terrain.o
	$(CC) $^ -o test.exe $(LIBS) $(INCLUDE) -s

clean :
	rm *.o

all : clean test
  

  
C:\Omat tiedostot\Stefan\prog\test_1>make
g++ test.o terrain.o -o test.exe -lgamelibrary -lopengl32 -lglu32 -lSDL -lfreetype  -I/usr/include -I/usr/include/freetype2 -L../gamelibrary -L/gcc-2.95.2/i386-mingw32msvc/lib -s /gcc-2.95.2/i386-mingw32msvc/lib\libmingw32.a(main.o)(.text+0x8e): undefined reference to `WinMain@16''
MAKE.EXE: *** [test] Error 1
  
I installed gcc package I found link in cone3d.gamedev.net. Thanks for any help

Share this post


Link to post
Share on other sites
Thank you sooo much!!!

Btw. why does the order of libraries matter?

If order is -lopengl32 -lglu32 -lgamelibrary then I get a lot of undefined reference to gl* functions in my gamelibrary.

But if I flip order -lgamelibrary -lopengl32 -lglu32 then it's ok.

Also -lSDLmain has to be before -SDL.

I wonder why, I remember never having such case before.

[edited by - stefu on June 6, 2002 12:37:54 PM]

Share this post


Link to post
Share on other sites