SDL 2.0: linking error

女生的网名这么多〃 提交于 2019-12-18 08:49:14

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/23240158/sdl-2-0-linking-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!