SDL_main将问题与VS2010链接

SDL_main linking issue with VS2010

本文关键字:VS2010 链接 问题 main SDL      更新时间:2023-10-16

我已经为OpenGL应用程序编写了一些基本的设置代码:

#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

使用main的完整签名:

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

int main(int argc, char **argv) 

或者尝试实现CCD_ 2而不是CCD_。