我正在尝试使用以下代码测试 SDL:
#include <SDL.h>
int main(int argc, char** argv){
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Surface * screen = SDL_SetVideoMode(640,480,32,SDL_SWSURFACE);
bool IsRuning = true;
Uint32 Start;
SDL_Event Event;
while (IsRuning)
{
Start = SDL_GetTicks();
while (SDL_PollEvent(&Event))
{
switch (Event.type)
{
case SDL_QUIT:
IsRuning = false;
break;
default:
break;
}
}
if(1000/30 > (SDL_GetTicks() - Start))
SDL_Delay(1000/30 > (SDL_GetTicks() - Start));
}
SDL_Quit();
return 0;
}
并链接这个库:
SDLmain.lib
SDL.lib
OpenGL32.lib
glu32.lib
当我试图调试它时,它给了我这些错误:-
Warning 1 warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library c:\Users\administrator\documents\visual studio 2010\Projects\TestSDL\TestSDL\MSVCRTD.lib(cinitexe.obj)
Error 2 error LNK2019: unresolved external symbol ___report_rangecheckfailure referenced in function _redirect_output c:\Users\administrator\documents\visual studio 2010\Projects\TestSDL\TestSDL\SDLmain.lib(SDL_win32_main.obj)
Error 3 error LNK1120: 1 unresolved externals c:\users\administrator\documents\visual studio 2010\Projects\TestSDL\Debug\TestSDL.exe 1
这里缺少什么?!