我正在使用 Visual Studio 2010。
我收到了这个错误信息:
Error 9 error LNK2001: unresolved external symbol __imp____glewUseProgram C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 10 error LNK2001: unresolved external symbol __imp____glewUseProgram C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 11 error LNK2001: unresolved external symbol __imp____glewGetProgramInfoLog C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 12 error LNK2001: unresolved external symbol __imp____glewGetProgramiv C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 13 error LNK2001: unresolved external symbol __imp____glewLinkProgram C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 14 error LNK2001: unresolved external symbol __imp____glewAttachShader C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 15 error LNK2001: unresolved external symbol __imp____glewGetShaderInfoLog C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 16 error LNK2001: unresolved external symbol __imp____glewGetShaderiv C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 17 error LNK2001: unresolved external symbol __imp____glewCompileShader C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 18 error LNK2001: unresolved external symbol __imp____glewShaderSource C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 19 error LNK2001: unresolved external symbol __imp____glewCreateShader C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 20 error LNK2001: unresolved external symbol __imp____glewCreateProgram C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\InitShader.obj lab22
Error 21 error LNK2001: unresolved external symbol __imp____glewVertexAttribPointer C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 22 error LNK2001: unresolved external symbol __imp____glewEnableVertexAttribArray C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 23 error LNK2001: unresolved external symbol __imp____glewGetAttribLocation C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 24 error LNK2001: unresolved external symbol __imp____glewBufferData C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 25 error LNK2001: unresolved external symbol __imp____glewBindBuffer C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 26 error LNK2001: unresolved external symbol __imp____glewGenBuffers C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 27 error LNK2001: unresolved external symbol __imp____glewBindVertexArray C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 28 error LNK2001: unresolved external symbol __imp____glewGenVertexArrays C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 29 error LNK2019: unresolved external symbol __imp__glewInit@0 referenced in function _main C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 30 error LNK2001: unresolved external symbol __imp__glewExperimental C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\lab22\lab22.obj lab22
Error 31 error LNK1120: 21 unresolved externals C:\Users\LENOVO\Desktop\Tugas\Smst5\Komgraf\lab\lab22\Debug\lab22.exe lab22
这是我的程序
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")
#pragma comment(lib, "glut32.lib")
#include "include\Angel.h"
const int NumPoints = 3;
void
init( void )
{
// Specifiy the vertices for a triangle
vec2 vertices[3] = {
vec2( -0.75, -0.75 ), vec2( 0.0, 0.75 ), vec2( 0.75, -0.75 )
};
// Create a vertex array object
GLuint vao[1];
glGenVertexArrays( 1, vao );
glBindVertexArray( vao[0] );
// Create and initialize a buffer object
GLuint buffer;
glGenBuffers( 1, &buffer );
glBindBuffer( GL_ARRAY_BUFFER, buffer );
glBufferData( GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW );
// Load shaders and use the resulting shader program
GLuint program = InitShader( "vshader21.glsl", "fshader21.glsl" );
glUseProgram( program );
// Initialize the vertex position attribute from the vertex shader
GLuint loc = glGetAttribLocation( program, "vPosition" );
glEnableVertexAttribArray( loc );
glVertexAttribPointer( loc, 2, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(0) );
glClearColor( 1.0, 1.0, 1.0, 1.0 ); // white background
}
void
display( void )
{
glClear( GL_COLOR_BUFFER_BIT ); // clear the window
glDrawArrays( GL_TRIANGLES, 0, NumPoints ); // draw the points
glFlush();
}
void
keyboard( unsigned char key, int x, int y )
{
switch ( key ) {
case 033:
exit( EXIT_SUCCESS );
break;
}
}
int
main( int argc, char **argv )
{
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGBA );
glutInitWindowSize( 512, 512 );
glutCreateWindow( "Red Triangle" );
glewExperimental=GL_TRUE;
glewInit();
init();
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
glutMainLoop();
return 0;
}
我想我已经正确安装了 glut、freeglut 和 glew,我已经编辑了我的链接器,但它仍然是错误的。我将 glut、freeglut 和 glew 文件夹放在我的项目和我的视觉工作室中,但它仍然显示该错误。对于我可以编译的第一个项目,现在我正在使用 Angle.h,它无法编译