For some reason, my OpenGL library file is not properly linked with Visual Studio 2013.
Here is my code:
#include <gl\glew.h>
#include <GL\GL.h>
#include <GL\GLU.h>
#include <GL\freeglut.h>
#include <iostream>
#include <cstdlib>
#pragma comment( lib, "OpenGL32.lib" )
#pragma comment( lib, "glu32.lib" )
#pragma comment( lib, "freeglut.lib" )
void init( void );
void display( void );
int main( int argc, char* argv[] )
{
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGBA );
glutInitWindowSize( 512, 512 );
glutInitContextVersion( 4, 0 );
glutInitContextProfile( GLUT_CORE_PROFILE );
glutCreateWindow( argv[0] );
glutDisplayFunc( display );
glutMainLoop();
return EXIT_SUCCESS;
}
void init( void ) { }
void display( void )
{
glClear( GL_COLOR_BUFFER_BIT );
return;
}
I compiled freeglut on my own system, and I don't get any errors from the program if I remove something specific related to OpenGL32.lib. (i.e., if I remove the glClear () function, my program compiles and runs without problems.) As soon as I add any GL commands, although I start getting binding errors.
1>main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
#pragma OpenGL32.lib , #pragma, - . 64- Windows 8.1 AMD Radeon 7700 HD . - - , ?