glload and LNK errors in VC++ EE 2010

702 views Asked by At

I'm trying to use glload from the Unofficial OpenGL SDK but I get LNK errors:

1>  LINK : C:\Users\T\documents\visual studio 2010\Projects\testi\Debug\testi.exe not found or not built by the last incremental link; performing full link
1>glloadD.lib(gll_gl_ext.obj) : error LNK2019: unresolved external symbol __imp__wglGetProcAddress@4 referenced in function _WinGetProcAddress
1>glloadD.lib(wgll_ext.obj) : error LNK2001: unresolved external symbol __imp__wglGetProcAddress@4 
1>C:\Users\T\documents\visual studio 2010\Projects\testi\Debug\testi.exe : fatal error LNK1120: 1 unresolved externals


#include <glload/gl_all.h>
#include <glload/gll.hpp>

void main()
{
    glload::LoadFunctions();
}

Linker/Additional Dependencies: glloadD.lib Where is the problem ?

Edit 1:

First I used Premake to generate build files for vs2010. Then I built all libraries. In my project I set Additional Include Directories, Additional Library Directories and Additional Dependencies for those libraries. I want to run an example from this page: link but I forgot to create OpenGL context before loading opengl functions. I don't need a window in this project so I just call glutInit, but I get an unhandled exception at 0x5bfed398 (msvcr100d.dll)

#include <glload/gl_all.h>
#include <glload/gll.hpp>
#include <freeglut/freeglut.h>

int main(int argc, char* argv[])
{
    glutInit(&argc, argv);
    glload::LoadFunctions();
}

Edit 2:

Calling glutCreateWindow before glload::LoadFunctions seems to be necessary. Following code works:

#include <glload/gl_all.h>
#include <glload/gll.hpp>
#include <freeglut/freeglut.h>

int main(int argc, char* argv[])
{
    glutInit(&argc, argv);
    glutCreateWindow("");
    glload::LoadFunctions();
}
1

There are 1 answers

0
Pol Gomez Riquelme On

The solution is to create a working context before initializing GlLoad. I've had this problem every time i've started an OpenGL project with GLSDK.