调试opengl程序出错

今天要做opengl实验

打开一个示例程序,结果编译不过。错误大概如下:

d:\vc98\include\gl\gl.h(1152) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1152) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1152) : error C2146: syntax error : missing ',' before identifier 'glAccum'
d:\vc98\include\gl\gl.h(1152) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1152) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1153) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1153) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1153) : error C2146: syntax error : missing ',' before identifier 'glAlphaFunc'
d:\vc98\include\gl\gl.h(1153) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1153) : error C2059: syntax error : ')'

。。。

 

查了好久,上网找到的说法也是乱七八糟。。。

 

后来终于看来这个:

#include <GL/glut.h>
#include "glee.h" // 错误,因为glut.h中含有gl.h,它与glee.h冲突
// 但是如果把两个include顺序交换,则正确
"glos.h":虽然这个也时常见到,但我也不知道它到底是什么,可能是与系统相关的各种功能,也可能只是自己编写的一个文件。我曾经看到一个glos.h头文件中只有一句#include <GL/glut.h>。

 

原来是头文件这块出了问题。

//#include <GL/gl.h>      // The GL Header File
#include <GL/glut.h>    // The GL Utility Toolkit (Glut) Header

我把第一个注释掉后,终于success!

转载于:https://www.cnblogs.com/laizhd/archive/2011/06/18/2084130.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值