I am using Visual Studio 2010.
And I have got this error message:
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
this is my program
#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;
}
I think I already install glut,freeglut and glew correctly, I already edit my linker but its still error. I put glut, freeglut, and glew folder in my project and in my visual studio but it still show that error. for the first project I can compile, now I'm using Angle.h and it cannot compile
Since you are using pre-processor hacks to link against the rest of your libraries, I imagine you probably want to do this:
Usually you would use project settings to set up linked libraries, but a lot of tutorials use the pre-processor directive because it avoids having to walk users through configuring Visual Studio projects (which differs with every new version).