调试第一个opengl 程序竟然有误,请大家多多帮忙。

superzrb 2003-08-26 05:00:14
感觉是vc6环境没设置好:
出错问题是:
Compiling...
aa.cpp
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2144: syntax error : missing ';' before type 'void'
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

aa.obj - 3 error(s), 0 warning(s)

源代码如下:
#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);
}
...全文
75 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
MooseWOler 2003-08-27
  • 打赏
  • 举报
回复
2楼写的没错,但是运行之前还要把opengl32.lib,glu32.lib,glaux.lib
3个库import进去,这样就没问题了。
superzrb 2003-08-27
  • 打赏
  • 举报
回复
库opengl32.lib,glu32.lib,glaux.lib我在project的settting中本就已经设置好了。

FatGarfield说的是对的。给分了。
rogueking 2003-08-26
  • 打赏
  • 举报
回复
先看看其他地方有没有调过gl.h,glu.h,glaux.h三个文件。再试试二楼的方法。
FatGarfield 2003-08-26
  • 打赏
  • 举报
回复

#include "windows.h"
#include <GL/gl.h>
#include <GL/glaux.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);
}
gzshd 2003-08-26
  • 打赏
  • 举报
回复

#include <GL/gl.h>
#include <GL/glaux.h>
#include "glos.h"

#pragma comment(lib,"opengl32.lib");
#pragma comment(lib,"glu32.lib");
#pragma comment(lib,"glaux.lib");

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);
}

19,472

社区成员

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

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