【问题标题】:SDL on Eclipse issueEclipse 问题上的 SDL
【发布时间】:2013-10-08 18:00:30
【问题描述】:

我已经在 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)

【问题讨论】:

标签: c windows eclipse mingw sdl


【解决方案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[]);

【讨论】:

  • 谢谢,不过还是不行。它给出了同样的错误
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-01-26
  • 2013-06-06
  • 1970-01-01
  • 2012-07-10
相关资源
最近更新 更多