Search code examples
qtopenglqt4mingwmingw32

glload error in Qt


Trying to create an OpenGL application using glload in Qt, I tested sample code.

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

using namespace std;

int main()
{
    glload::LoadFunctions();
    cout << "Hello World!" << endl;
    return 0;
}

But when I run it, it stop working. The debug error is

can't run ": The requested operation requires elevation.

The build command is

qmake.exe C:\Users\Benbroher\test\test.pro -r -spec win32-g++ "LIBS+=-lglloadD" "LIBS+=-lopengl32"

My Qt is 4.8.1, and glsdk is 0.4.4. I am running a 64-bit version of windows7, and it happened in a 32-bit version of winXP.

What might cause this and how do I solve it?


Solution

  • You cannot load OpenGL functions until you have created a valid OpenGL context and made it current. The documentation is very clear on this.