【发布时间】:2013-12-07 12:52:09
【问题描述】:
我有这个代码:
#include <iostream>
#include <glew.h>
#include <SDL.h>
#pragma comment(lib, "glew32.lib")
#pragma comment(lib, "SDL2.lib")
using namespace std;
int main(){
return 0;
}
我收到这些错误:
/usr/include/w32api/GL/glu.h:68:79: error: expected ‘)’ before ‘*’ token
void APIENTRY gluQuadricCallback(GLUquadric *qobj,GLenum which,void (CALLBACK *fn)());
^
/usr/include/w32api/GL/glu.h:68:79: error: expected ‘)’ before ‘*’ token
/usr/include/w32api/GL/glu.h:68:79: error: expected initializer before ‘*’ token
/usr/include/w32api/GL/glu.h:78:79: error: expected ‘)’ before ‘*’ token
void APIENTRY gluTessCallback(GLUtesselator *tess,GLenum which,void (CALLBACK *fn)());
...
出了什么问题? 似乎 glu.h 属于 MinGW 包。我将 NetBeans 与 Cygwin 一起使用。
【问题讨论】:
-
我很确定 MinGW 附带的 gcc 版本不理解您的
#pragma comment(lib, ...)指令。这些是告诉链接器使用这些库的非标准 Microsoft Visual C 指令。您将需要将-lglew32和-lSDL2之类的内容添加到链接器命令行以使其可移植。此外,CALLBACK 可能没有定义...... GLU 应该处理这个,但如果它没有#include <Windows.h>(其中隐含包含 WinDef.h)肯定会。