我已经在Win 7上的Eclipse上安装了SDL。我已将SDL2的MinGw zip文件中的所有文件放在正确的位置(我认为)。我将dll放在系统文件夹中,MinGW的lib中的lib和include中的SDL2文件夹。我添加了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)
答案 0 :(得分:1)
int main()
^ where have all the arguments gone?
试试这个:
int main( int argc, char* argv[] )
The SDL_main
symbol is kinda particular:
extern C_LINKAGE int SDL_main(int argc, char *argv[]);