Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
460 views
in Technique[技术] by (71.8m points)

codeblocks - 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:SDLSDL2libx86 -o binDebugest.exe objDebugest.o  -lmingw32 -lSDL2main -lSDL2   -mwindows
C:SDLSDL2libx86/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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...