2012-03-15 56 views
0
連接問題

我已經寫了一些基本的設置代碼OpenGL應用程序:SDL_main與VS2010

#include <Windows.h> 
#include <gl/gl.h> 
#include <SDL.h> 

int main() 
{ 
    SDL_Init(SDL_INIT_VIDEO); 

    SDL_Surface* surface = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_OPENGL); 
    glViewport(0, 0, 800, 600); 

    SDL_Event windowEvent; 
    while (true) 
    { 
     if (SDL_PollEvent(&windowEvent)) 
     { 
      if (windowEvent.type == SDL_QUIT) break; 
     } 

     glClearColor(1.0f, 0.0f, 0.0f, 1.0f); 
     glClear(GL_COLOR_BUFFER_BIT); 

     SDL_GL_SwapBuffers(); 
    } 

    SDL_Quit(); 
    return 0; 
} 

不幸失敗,錯誤如下鏈接:

1>SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol _SDL_main 

連接器設置:

http://puu.sh/kVae

回答

4

使用main's full s ignature:

int main(int argc, char *argv[]) 

int main(int argc, char **argv) 

,或者嘗試實現_SDL_Main,而不是main