0

我正在尝试使用非官方 OpenGL SDK 中的 glload,但出现 LNK 错误:

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();
}

链接器/附加依赖项:glloadD.lib 问题出在哪里?

编辑1:

首先我使用 Premake 为 vs2010 生成构建文件。然后我建立了所有的图书馆。在我的项目中,我为这些库设置了附加包含目录、附加库目录和附加依赖项。我想从这个页面运行一个示例:链接,但我忘记在加载 opengl 函数之前创建 OpenGL 上下文。我在这个项目中不需要窗口,所以我只调用 glutInit,但在 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();
}

编辑2:

在 glload::LoadFunctions 之前调用 glutCreateWindow 似乎是必要的。以下代码有效:

#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();
}
4

1 回答 1

0

解决方案是在初始化 GlLoad 之前创建一个工作上下文。每次使用 GLSDK 启动 OpenGL 项目时,我都会遇到这个问题。

于 2013-08-21T22:40:40.763 回答