|
小妹是opengl菜鸟,还旺各位大虾相助。我qq:68754994
编译结果:
OpenGL1.obj : error LNK2019: 无法解析的外部符号 __imp____glutInitWithExit@12,该符号在函数 _glutInit_ATEXIT_HACK@8 中被引用
OpenGL1.obj : error LNK2019: 无法解析的外部符号 __imp____glutCreateWindowWithExit@8,该符号在函数 _glutCreateWindow_ATEXIT_HACK@4 中被引用
F:\tt\OpenGL\OpenGL1\OpenGL1\Debug\OpenGL1.exe : fatal error LNK1120: 2 个无法解析的外部命令
发现是两个原代码中两个函数引起的
glutInit(&argc,argv); glut中仿佛没有这个函数
glutCreateWindow("the name of window");
是因为这两个函数引起的,不知道为什么。
原代码:就是新建一个窗口,显示一个线段的程序。]
#include "stdafx.h"
#include <windows.h>
#include <Gl/glut.h>
void init (void)
{
//set display-window color to white.
glClearColor (1.0,1.0,1.0,0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0,200.0,0.0,150.0);
}
void lineSegment(void)
{
//create display-window.
glClear(GL_COLOR_BUFFER_BIT);
//set line segment color to red.
glColor3f(1.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2i(180,15);
glVertex2i(10,145);
glEnd();
//Process all OpenGL routines as quickly as possible
glFlush();
}
void main (int argc, char** argv)
{
//Initialize Glut.
glutInit(&argc,argv);
//set display mode.
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
//set top-left display-windows position.
glutInitWindowPosition(50,100);
//set display-window width and height
glutInitWindowSize(400,300);
//creat display-window.
glutCreateWindow("An Example OpenGL Program by TingTing");
init();
//send graphics to display window.
glutDisplayFunc(lineSegment);
//display everything and wait.
glutMainLoop();
}
[em4]求助 |
|