Re: [Dev-C++] Linking Error with SDL
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <or...@vp...> - 2004-09-12 23:45:25
|
Scott Simontis wrote: > I downloaded the SDL DevPak and have been attempting to use it. I have=20 > had no luck yet. Whenever I compile, even when using the Dev-C++ SDL=20 > template, I get a linker error. Everything compiles correctly, but I ge= t=20 > the following errors: > [Linker error] undefined reference to `SDL_main' > C:\Code\Makefile.win [Build Error] exe: *** [sdltest.exe] Error 1 On windows, your main() function is redefined to SDL_main() by the SDL_ma= in.h header, and=20 the function will be called from within SDL. However, somehow you need to= tell the SDL=20 headers that you're under windows, otherwise your main() will not be rede= fined to=20 SDL_main(), hence you'll get a linker error, because the library itself w= ants to call=20 SDL_main(), but it is not present. Add -DWIN32 or -D_WIN32 to your project options, and the problem should g= o away. Note, that I only suspected the above by peeking at the headers, I haven'= t tested it. -- Greetings, Bal=E1zs |