【发布时间】:2016-01-01 13:23:06
【问题描述】:
我正在尝试用 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
到目前为止一切正常(glGenVertexArrays()、glDrawArrays() 等),只有纹理函数(glGenTextures()、glBindTexture() 等)不起作用。
Linker 是这样设置的:glew32.lib;glfw3.lib;assimp.lib;devil.lib;magickdb.lib;magickrl.lib;%(AdditionalDependencies)
VC 包含目录:
C:\Users\Dynamitos5\Documents\cuda\OpenGLTest\external\include;$(IncludePath)
VC 库目录:
C:\Users\Dynamitos5\Documents\cuda\OpenGLTest\external\lib;$(LibraryPath)
【问题讨论】:
-
你缺少 opengl32.lib 吗?
-
@BDL 我认为 opengl32.lib 仅适用于已弃用的 OpenGL1.1 的东西。我这边的误会/_\。如果您将其发布为答案,我会接受它
标签: c++ opengl linker visual-studio-2015