error LNK2019这个问题怎么解决

冰封_的心 2014-03-29 02:03:06
# define GLUT_DISABLE_ATEXIT_HACK
# include <stdlib.h>
# include <math.h>
# include <windows.h>
# include <GL/glut.h>

# define DEG_TO_RAD 0.017453
GLfloat theta=0.0;
const GLfloat R=0.5f;
int Singleb,doubleb;
void myDisplay()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(R*sin(DEG_TO_RAD*theta),R*cos(DEG_TO_RAD*theta));
glVertex2f(-R*sin(DEG_TO_RAD*theta),R*cos(DEG_TO_RAD*theta));
glVertex2f(-R*sin(DEG_TO_RAD*theta),-R*cos(DEG_TO_RAD*theta));
glVertex2f(R*sin(DEG_TO_RAD*theta),-R*cos(DEG_TO_RAD*theta));
glEnd();
glutSwapBuffers();
}
void spinDisplay()
{
theta += 2.0;
if(theta>360.0) theta-=360.0;
glutSetWindow(Singleb);
glutPostWindowRedisplay(Singleb);
glutSetWindow(doubleb);
glutPostWindowRedisplay(doubleb);
}
void mouse(int btn,int state,int x,int y){
if(btn==GLUT_LEFT_BUTTON&&state==GLUT_DOWN)
glutIdleFunc(spinDisplay);
if(btn==GLUT_MIDDLE_BUTTON&&state==GLUT_DOWN)
glutIdleFunc(NULL);
}
void myReshape(int w ,int h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-0.2,0.2,-0.2,0.2);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void mykey(unsigned char key, int x, int y){
if(key=='Q'||key=='q') exit(0);
}
void quit_menu(int id){
if(id==1) exit(0);
}
void init()
{
glClearColor(1.0,1.0,0.0,0.0);
glColor3f(0.5,0.5,0.5);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-1.0,1.0,-1.0,1.0);
}
int main (int argc, char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
Singleb=glutCreateWindow("single buffered");
init();
glutDisplayFunc(myDisplay);
glutReshapeFunc(myReshape);
glutIdleFunc(spinDisplay);
glutKeyboardFunc(mykey);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowPosition(100,100);
doubleb=glutCreateWindow("double buffered");
init();
glutDisplayFunc(myDisplay);
glutReshapeFunc(myReshape);
glutIdleFunc(spinDisplay);
glutMouseFunc(mouse);
glutCreateMenu(quit_menu);
glutAddMenuEntry("quit",1);

glutMainLoop();
return 0;
}
哪位大神给看看到底哪里 不对啊,新人求大神帮忙啊,为什么运行不出来呢。
...全文
247 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ccrun.com 2014-03-31
  • 打赏
  • 举报
回复
小裴同学,你需要把相关的lib文件添加到工程中。
MonkeyKingMKY 2014-03-29
  • 打赏
  • 举报
回复
为什么 看着 这么像 VS 呢? 而不是 C++Builder

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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