How do you get a minimal SDL program to compile and link in visual studio 2008 express?

后端 未结 3 991
情书的邮戳
情书的邮戳 2020-12-11 05:05

I\'m trying to use SDL in C++ with Visual Studio 2008 Express. The following program compiles but does not link:

#include 

int main(int argc, c         


        
3条回答
  •  孤街浪徒
    2020-12-11 05:44

    To me it helped to add the following lines before main():

    #ifdef _WIN32
    #undef main
    #endif
    

    German Wikipedia also suggests to add these lines instead:

    #ifdef _WIN32
    #pragma comment(lib, "SDL.lib")
    #pragma comment(lib, "SDLmain.lib")
    #endif
    

    Though I still had link errors when I tried second solution.

提交回复
热议问题