opengl 的初级问题,请高手指教

woshishui11121113 2004-10-25 09:47:34
代码如下:
#include <GL/gl.h>
#include <GL/glaux.h>
#include "glos.h"

void main(void)
{
 auxInitDisplayMode(AUX_SINGLE|AUX_RGBA);
 auxInitPosition(0,0,500,500);
 auxInitWindow("simple");

 glClearColor(0.0,0.0,0.0,0.0);
 glClear(GL_COLOR_BUFFER_BIT);

 glColor3f(1.0,0.0,0.0);
 glRectf(-0.5,-0.5,0.5,0.5);

 glFlush();
 _sleep(1000);
}

出现如下错误:

c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1153) : error C2144: syntax error : missing ';' before type 'void'
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1153) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1153) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

不知道是什么原因,请高手救命啊
...全文
82 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
shower1981 2004-10-25
  • 打赏
  • 举报
回复


改两处
1在 #include <GL/gl.h> 前加 #include "windows.h"
2加连接:opengl32.lib glu32.lib glaux.lib
woshishui11121113 2004-10-25
  • 打赏
  • 举报
回复
??
woshishui11121113 2004-10-25
  • 打赏
  • 举报
回复
不行啊,55555555555555
syy64 2004-10-25
  • 打赏
  • 举报
回复
1、
#include <gl/gl.h>
#include <GL/glu.h>
#include <GL/glaux.h>
2、连接选项里加上:
opengl32.lib glu32.lib glaux.lib
3、正确设置库文件和头文件目录。
shower1981 2004-10-25
  • 打赏
  • 举报
回复

error C2144: syntax error : missing ';' before type 'void'
表示前面有什么东西没有定义。

显然 WINGDIAPI 是需要windows.h的支持。
yjh1982 2004-10-25
  • 打赏
  • 举报
回复
微软平台下就是如此.
woshishui11121113 2004-10-25
  • 打赏
  • 举报
回复
问题解决了,呵呵

但是能告诉我为什么要把windows.h引用进来才能用呢??

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧