gpt4 book ai didi

c++ - OpenGL 链接问题

转载 作者:行者123 更新时间:2023-11-30 01:45:28 31 4
gpt4 key购买 nike

我正在尝试用 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() 等)不起作用。链接器设置如下: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)

最佳答案

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

在您的情况下,您缺少再次链接 opengl32.lib

关于c++ - OpenGL 链接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34556500/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com