0

我已经在 Win 7 上的 Eclipse 上安装了 SDL。我已将 SDL2 的 MinGw zip 文件中的所有文件放在正确的位置(我认为)。我将dll放在系统文件夹中,将lib放在MinGW的lib中,将SDL2文件夹放在include中。我添加了指向 SDL2 和 SDL2main 的链接,然后我写了这个:

#include <stdio.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <omp.h>
#include "SDL2/SDL.h"

int main()
{
    SDL_Init( SDL_INIT_EVERYTHING );
    SDL_Quit();

    return 0;
}

但我收到此错误消息:

18:56:11 **** Incremental Build of configuration Debug for project Graphics ****
Info: Internal Builder is used for build
g++ -O3 -g3 -Wall -c -fmessage-length=0 -o View.o "..\\View.cpp" 
g++ -o Graphics.exe View.o -lglu32 -lSDL2main -lSDL2 -lgomp -lglew32 -lfreeglut -lopengl32 
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/libmingw32.a(main.o): In function `main':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/main.c:91: undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status

18:56:12 Build Finished (took 830ms)
4

1 回答 1

1
int main()
         ^ where have all the arguments gone?

尝试这个:

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

这个SDL_main符号有点特别

extern C_LINKAGE int SDL_main(int argc, char *argv[]);
于 2013-10-08T18:10:05.257 回答