For some reason my OpenGL library file isn't linking correctly for Visual Studio 2013.
Here is all of 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 anything specifically having to do with OpenGL32.lib. (i.e. if I remove the glClear() function, my program compiles and runs with no problems.) As soon as I add any GL commands though I start getting linking errors.
1>main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
I've also tried taking out the #pragma directive and adding the OpenGL32.lib file into the additional dependencies for the linker and I've tried calling the #pragma directives before anything else in the program to no avail. I'm running a 64x Windows 8.1 box with an AMD Radeon 7700 HD series graphics card and brand new drivers for said card. Anyone got any ideas about what may be happening?