OpenGL 链接问题

Dyn*_*tos 2 c++ opengl linker visual-studio-2015

我正在尝试用 C++ 构建一个 OpenGL 应用程序。我使用 glew 和 glfw 库。现在我想创建一些纹理,但现在它说:

1>model.obj : error LNK2019: unresolved external symbol __imp_glBindTexture referenced in function "public: void __cdecl Texture::Bind(unsigned int)" (?Bind@Texture@@QEAAXI@Z)
1>model.obj : error LNK2019: unresolved external symbol __imp_glGenTextures referenced in function "public: bool __cdecl Texture::Load(void)" (?Load@Texture@@QEAA_NXZ)
1>model.obj : error LNK2019: unresolved external symbol __imp_glTexImage2D referenced in function "public: bool __cdecl Texture::Load(void)" (?Load@Texture@@QEAA_NXZ)
1>model.obj : error LNK2019: unresolved external symbol __imp_glTexParameterf referenced in function "public: bool __cdecl Texture::Load(void)" (?Load@Texture@@QEAA_NXZ)
1>C:\Users\Dynamitos5\Documents\cuda\OpenGLTest\external\lib\magickdb.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'
1>C:\Users\Dynamitos5\Documents\cuda\OpenGLTest\external\lib\magickrl.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'
1>C:\Users\Dynamitos5\Documents\cuda\OpenGLTest\x64\Debug\OpenGLTest3.exe : fatal error LNK1120: 16 unresolved externals
Run Code Online (Sandbox Code Playgroud)

到目前为止一切正常(glGenVertexArrays()、glDrawArrays() 等),只有纹理函数(glGenTextures()、glBindTexture() 等)不起作用。链接器设置如下:glew32.lib;glfw3.lib;assimp.lib;devil.lib;magickdb.lib;magickrl.lib;%(AdditionalDependencies)

VC 包含目录: C:\Users\Dynamitos5\Documents\cuda\OpenGLTest\external\include;$(IncludePath) VC lib 目录: C:\Users\Dynamitos5\Documents\cuda\OpenGLTest\external\lib;$(LibraryPath)

BDL*_*BDL 7

OpenGL 1.1 之前的所有功能都直接在opengl32.lib库中实现。所有其他功能都可以通过扩展获得,并且必须手动加载(或使用像glew这样的库)。

在您的情况下,您缺少重新链接opengl32.lib.