Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDL 2.0: linking error

I know that similar questions had been asked but none of the answers helped me...

I wrote a simple SDL program:

#include "SDL.h"
int main( int argc, char* args[] )
{
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );

//Quit SDL
SDL_Quit();

return 0;
}

using Code:Blocks. I followed this tutorial http://lazyfoo.net/SDL_tutorials/lesson01/windows/codeblocks/index.php but I still cannot compile. Here is the build log:

mingw32-g++.exe -LC:\SDL\SDL2\lib\x86 -o bin\Debug\test.exe obj\Debug\test.o  -lmingw32 -lSDL2main -lSDL2   -mwindows
C:\SDL\SDL2\lib\x86/SDL2main.lib(./Release/SDL_windows_main.obj):(.text[_main]+0x0): multiple definition of `main'
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../libmingw32.a(main.o):main.c:(.text.startup+0x0): first defined here
Warning: .drectve `/manifestdependency:"type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
collect2.exe: error: ld returned 1 exit status

Any idea?

like image 792
addru Avatar asked Nov 01 '22 01:11

addru


1 Answers

The correct link to follow for setting up SDL2.0 for Code::Blocks is http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php. This will help to make the correct setup.

The 32bit libraries are in i686-w64-mingw32 folder.

like image 134
addru Avatar answered Dec 07 '22 16:12

addru