标题:关于一个简单的OPENGL程序无法运行的问题请这方面的高手解答一下1
取消只看楼主
renhao153
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-11-10
 问题点数:0 回复次数:2 
关于一个简单的OPENGL程序无法运行的问题请这方面的高手解答一下1
这是一个在VC6的WIN32控制台下的程序
#include "GL/gl.h"
#include "GL/glu.h"
#include "GL/glaux.h"
#include "stdlib.h"

void display(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1.0,1.0,1.0);
    glLoadIdentity();
    glTranslatef(0.0,0.0,-5.0);
    glScalef(1.0,2.0,1.0);
    auxWireCube(1.0);
    glFlush();
}
void myinit(void)
{
    glShadeModel(GL_FLAT);
}
void myReshape(int w,int h)
{
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glFrustum(-1.0,1.0,-1.0,1.0,1.5,20.0);
    glMatrixMode(GL_MODELVIEW);
    glViewport(0,0,w,h);
}
int main(int argc,char **argv)
{
    auxInitDisplayMode(AUX_SINGLE|AUX_RGB);
    auxInitPosition(0,0,500,500);
    auxInitWindow(argv[0]);
    myinit();
    auxReshapeFunc(myReshape);
    auxMainLoop(display);
}

[[it] 本帖最后由 renhao153 于 2008-7-13 13:11 编辑 [/it]]
搜索更多相关主题的帖子: OPENGL void include 
2008-07-13 13:10
renhao153
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-11-10
得分:0 
急回复一下高手们出的错误是
Compiling...
cs.c
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 : ')'
d:\vc98\include\gl\gl.h(1154) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1154) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1154) : error C2146: syntax error : missing ',' before identifier 'glAreTexturesResident'
d:\vc98\include\gl\gl.h(1154) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1154) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1155) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1155) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1155) : error C2146: syntax error : missing ',' before identifier 'glArrayElement'
d:\vc98\include\gl\gl.h(1155) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1155) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1156) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1156) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1156) : error C2146: syntax error : missing ',' before identifier 'glBegin'
d:\vc98\include\gl\gl.h(1156) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1156) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1157) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1157) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1157) : error C2146: syntax error : missing ',' before identifier 'glBindTexture'
d:\vc98\include\gl\gl.h(1157) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1157) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1158) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1158) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1158) : error C2146: syntax error : missing ',' before identifier 'glBitmap'
d:\vc98\include\gl\gl.h(1158) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1158) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1159) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1159) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1159) : error C2146: syntax error : missing ',' before identifier 'glBlendFunc'
d:\vc98\include\gl\gl.h(1159) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1159) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1160) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1160) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1160) : error C2146: syntax error : missing ',' before identifier 'glCallList'
d:\vc98\include\gl\gl.h(1160) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1160) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1161) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1161) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1161) : error C2146: syntax error : missing ',' before identifier 'glCallLists'
d:\vc98\include\gl\gl.h(1161) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1161) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1162) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1162) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1162) : error C2146: syntax error : missing ',' before identifier 'glClear'
d:\vc98\include\gl\gl.h(1162) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1162) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1163) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1163) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1163) : error C2146: syntax error : missing ',' before identifier 'glClearAccum'
d:\vc98\include\gl\gl.h(1163) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1163) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1164) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1164) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1164) : error C2146: syntax error : missing ',' before identifier 'glClearColor'
d:\vc98\include\gl\gl.h(1164) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1164) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1165) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1165) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1165) : error C2146: syntax error : missing ',' before identifier 'glClearDepth'
d:\vc98\include\gl\gl.h(1165) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1165) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1166) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1166) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1166) : error C2146: syntax error : missing ',' before identifier 'glClearIndex'
d:\vc98\include\gl\gl.h(1166) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1166) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1167) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1167) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1167) : error C2146: syntax error : missing ',' before identifier 'glClearStencil'
d:\vc98\include\gl\gl.h(1167) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1167) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1168) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1168) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1168) : error C2146: syntax error : missing ',' before identifier 'glClipPlane'
d:\vc98\include\gl\gl.h(1168) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1168) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1169) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1169) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1169) : error C2146: syntax error : missing ',' before identifier 'glColor3b'
d:\vc98\include\gl\gl.h(1169) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1169) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1170) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1170) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1170) : error C2146: syntax error : missing ',' before identifier 'glColor3bv'
d:\vc98\include\gl\gl.h(1170) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1170) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1171) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1171) : error C2085: 'APIENTRY' : not in formal parameter list
d:\vc98\include\gl\gl.h(1171) : error C2146: syntax error : missing ',' before identifier 'glColor3d'
d:\vc98\include\gl\gl.h(1171) : error C2143: syntax error : missing ';' before '('
d:\vc98\include\gl\gl.h(1171) : error C2059: syntax error : ')'
d:\vc98\include\gl\gl.h(1172) : error C2054: expected '(' to follow 'WINGDIAPI'
d:\vc98\include\gl\gl.h(1172) : fatal error C1003: error count exceeds 100; stopping compilation
2008-07-13 13:14
renhao153
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-11-10
得分:0 
谢谢
auxReshapeFunc((AUXRESHAPEPROC)myReshape);
    auxMainLoop((AUXMAINPROC)display);
中的(AUXRESHAPEPROC)为什么要这样加了
2008-07-14 10:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-223713-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.785997 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved