Starting off

Started by
8 comments, last by Mr_Ridd 20 years ago
Howzit I''m trying to get the first tutorial of the OpenGL tutorials at gametutorials.com to work, and it''s giving me this in Dev-C++: [Linker error] undefined reference to `WinMain@16'' I''ve got a main method and I''ve included the relevent files in my project options. Shot
The ability to succeed is the ability to adapt
Advertisement
#include "windows.h"

Or perhaps you havent defined the WinMain method

[edited by - psamty10 on March 24, 2004 1:21:16 AM]
That didn''t work, it still gave me the same error.

I''ve got a main() function NOT a WinMain() function.
The ability to succeed is the ability to adapt
Try changing the linker settings. It sounds like you''re building the application for the windows subsystem when you want to build the application for the console subsystem.
I have put it as a console system. I don''t know what the hell is going on. This is what I have for my linker options:

../lib/libSDL.a
../lib/libSDLmain.a
../lib/libmingw32.a
../lib/libopengl32.a
../lib/libglu32.a

Including windows.h and providing the nessacary library file doesn''t work either.
The ability to succeed is the ability to adapt
Oh, SDL messes things up. Try switching it to a windows application.
That still didn''t work.

What else can I use instead of SDL? Or do I have to use anything at all?
The ability to succeed is the ability to adapt
When using gcc with SDL you have to specify the main function to be the SDL main function, which then calls your main(). On the command line you would add -Dmain=SDL_main, not sure how that integrates into Dev-C++

Also you don''t have to include windows.h just

#include <sdl/sdl.h>
#include <gl/gl.h>
#include <gl/glu.h>

I also think that you must use this signature for main, however I am not sure, but it won''t hurt anyways.

int main(int argc, char **argv)

The parameters are mandatory.

Hope that this helps you out.
You might also try putting SDLMain.a before SDL.a in the link order. IIRC, reversing the order sometimes causes conflicts.
I got it to work, I had to put ../lib/libmingw32.a first.
Thanks for all your help.
The ability to succeed is the ability to adapt

This topic is closed to new replies.

Advertisement