SOIL2 文件上未解析的外部符号 - 需要 opengl 调用
Unresolved External Symbol on SOIL2 Files - requires opengl calls
似乎当我尝试构建我的项目时,由于来自 SOIL2 的一些未解析的外部符号,构建失败了。它不知道像这样的调用:“__imp_glTexParameteri”是什么。我的项目中有 glfw 库,但它似乎仍然认为我对此没有任何引用。我的项目中有 gl 调用,但它似乎没有扩展到 SOIL2 库。我能做些什么吗?
需要更多信息吗?
我已经确认 x64 space 中 运行 的库是 x64,而 x32 space[=] 中的 x32 库是 运行 11=]
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_wglGetProcAddress referenced in function SOIL_GL_GetProcAddress
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glBindTexture referenced in function SOIL_direct_load_DDS_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glDeleteTextures referenced in function SOIL_direct_load_DDS_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glGenTextures referenced in function SOIL_direct_load_DDS_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glGetError referenced in function SOIL_direct_load_ETC1_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glGetIntegerv referenced in function SOIL_GL_ExtensionSupported
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glGetString referenced in function SOIL_GL_ExtensionSupported
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glPixelStorei referenced in function SOIL_direct_load_ETC1_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glReadPixels referenced in function SOIL_save_screenshot
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glTexImage2D referenced in function SOIL_direct_load_DDS_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glTexParameteri referenced in function SOIL_direct_load_DDS_from_memory
这是我得到的未解析的外部符号。
深吸一口气提前致歉post
来自 LNK2019 错误的文档:
There are many ways to get this error, but all of them involve a reference to a function or variable that the linker can't resolve, or find a definition for. The compiler can identify when a symbol is not declared, but not when it is not defined, because the definition may be in a different source file or library. If a symbol is referred to but never defined, the linker generates an unresolved external symbol error.
@xaxxon 说的是对的。 linker 生成警告的函数都是 OpenGL 函数。
所以这些错误告诉你的是 SOIL2.obj 依赖于 OpenGL 库。
您可以 link 对抗两种常见形式的库,静态库和动态库。
由维基百科和技术百科提供:
静态库
In computer science, a static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, producing an object file and a stand-alone executable.
动态库或共享库
A dynamic library is a programming concept in which shared libraries with special functionalities are launched only during program execution, which minimizes overall program size and facilitates improved application performance for reduced memory consumption. In most software programs, distributing specific functionalities into distinct modules allows loading as needed.
A dynamic library is never part of an executable file or application. During runtime, a link is established between a dynamic library and executable file or application.
链接不是一个容易理解的概念,如果您刚刚开始,您可能想访问 Lazy Foo 的站点,它可以引导您了解 linking 与 freeglut 库的基础知识。
http://lazyfoo.net/tutorials/OpenGL/01_hello_opengl/windows/msvsnet2010u/index.php
但最基本的是;为了使用别人的库,您应该首先了解该库是如何创建的。该人创建的是静态库还是动态库。然后你可以计算出你应该如何 link 对抗那个库。
例如,当 link针对共享库时,您需要将 .dll 文件包含在可执行文件中,这是因为当程序是 运行 "remaining" 位时link 的程序已完成 "just in time" 到 运行。
参见:https://www.lurklurk.org/linkers/linkers.html
我知道这个答案太长太长,您可能只想要一个简单的答案:"Drag and drop this file in to x directory"。不幸的是,如果您坐下来了解编译器和 linker 等人实际上在做什么以及他们试图与您交流什么,它确实会有所回报。
我无法为您提供分步说明,因为这将取决于您拥有的库。
然而
如果您碰巧在 Visual Studio 中有一个项目,您可以使用 Nuget 包管理器作弊并安装 nupengl,它将为您安装 OpenGL 和 GLEW。
http://in2gpu.com/2014/11/29/setting-opengl-visual-studio-using-nuget/
记住这不是魔法!它只是 link 针对库,您真的应该学习如何在没有 Nuget 的情况下做到这一点。祝你好运!
似乎当我尝试构建我的项目时,由于来自 SOIL2 的一些未解析的外部符号,构建失败了。它不知道像这样的调用:“__imp_glTexParameteri”是什么。我的项目中有 glfw 库,但它似乎仍然认为我对此没有任何引用。我的项目中有 gl 调用,但它似乎没有扩展到 SOIL2 库。我能做些什么吗?
需要更多信息吗?
我已经确认 x64 space 中 运行 的库是 x64,而 x32 space[=] 中的 x32 库是 运行 11=]
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_wglGetProcAddress referenced in function SOIL_GL_GetProcAddress
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glBindTexture referenced in function SOIL_direct_load_DDS_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glDeleteTextures referenced in function SOIL_direct_load_DDS_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glGenTextures referenced in function SOIL_direct_load_DDS_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glGetError referenced in function SOIL_direct_load_ETC1_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glGetIntegerv referenced in function SOIL_GL_ExtensionSupported
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glGetString referenced in function SOIL_GL_ExtensionSupported
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glPixelStorei referenced in function SOIL_direct_load_ETC1_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glReadPixels referenced in function SOIL_save_screenshot
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glTexImage2D referenced in function SOIL_direct_load_DDS_from_memory
1>SOIL2.obj : error LNK2019: unresolved external symbol __imp_glTexParameteri referenced in function SOIL_direct_load_DDS_from_memory
这是我得到的未解析的外部符号。
深吸一口气提前致歉post
来自 LNK2019 错误的文档:
There are many ways to get this error, but all of them involve a reference to a function or variable that the linker can't resolve, or find a definition for. The compiler can identify when a symbol is not declared, but not when it is not defined, because the definition may be in a different source file or library. If a symbol is referred to but never defined, the linker generates an unresolved external symbol error.
@xaxxon 说的是对的。 linker 生成警告的函数都是 OpenGL 函数。
所以这些错误告诉你的是 SOIL2.obj 依赖于 OpenGL 库。
您可以 link 对抗两种常见形式的库,静态库和动态库。
由维基百科和技术百科提供:
静态库
In computer science, a static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, producing an object file and a stand-alone executable.
动态库或共享库
A dynamic library is a programming concept in which shared libraries with special functionalities are launched only during program execution, which minimizes overall program size and facilitates improved application performance for reduced memory consumption. In most software programs, distributing specific functionalities into distinct modules allows loading as needed.
A dynamic library is never part of an executable file or application. During runtime, a link is established between a dynamic library and executable file or application.
链接不是一个容易理解的概念,如果您刚刚开始,您可能想访问 Lazy Foo 的站点,它可以引导您了解 linking 与 freeglut 库的基础知识。
http://lazyfoo.net/tutorials/OpenGL/01_hello_opengl/windows/msvsnet2010u/index.php
但最基本的是;为了使用别人的库,您应该首先了解该库是如何创建的。该人创建的是静态库还是动态库。然后你可以计算出你应该如何 link 对抗那个库。
例如,当 link针对共享库时,您需要将 .dll 文件包含在可执行文件中,这是因为当程序是 运行 "remaining" 位时link 的程序已完成 "just in time" 到 运行。 参见:https://www.lurklurk.org/linkers/linkers.html
我知道这个答案太长太长,您可能只想要一个简单的答案:"Drag and drop this file in to x directory"。不幸的是,如果您坐下来了解编译器和 linker 等人实际上在做什么以及他们试图与您交流什么,它确实会有所回报。
我无法为您提供分步说明,因为这将取决于您拥有的库。
然而
如果您碰巧在 Visual Studio 中有一个项目,您可以使用 Nuget 包管理器作弊并安装 nupengl,它将为您安装 OpenGL 和 GLEW。
http://in2gpu.com/2014/11/29/setting-opengl-visual-studio-using-nuget/
记住这不是魔法!它只是 link 针对库,您真的应该学习如何在没有 Nuget 的情况下做到这一点。祝你好运!