OpenGL Link GLFW DDS 加载函数错误
OpenGL Link Error for GLFW DDS Load function
我一直在学习 OpenGL-tutorial.org 教程系列。一切都运行良好,但是我无法让教程 5 在我的 playground 可执行文件中运行,尽管它在示例教程 5 可执行文件中 运行 时确实有效。即使我复制并粘贴示例代码也是如此。
我收到以下错误:
Undefined symbols for architecture x86_64:
"loadDDS(char const*)", referenced from:
_main in playground.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
下面是 link 日志:
Ld playground/playground normal x86_64
cd /Users/RufusVijayaratnam/rufus/Coding/ogl-master
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-macos10.15 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/RufusVijayaratnam/rufus/Coding/ogl-master/playground -F/Users/RufusVijayaratnam/rufus/Coding/ogl-master/playground -filelist /Users/RufusVijayaratnam/rufus/Coding/OpenGL/Tutorials.build/Debug/playground.build/Objects-normal/x86_64/playground.LinkFileList -Xlinker -object_path_lto -Xlinker /Users/RufusVijayaratnam/rufus/Coding/OpenGL/Tutorials.build/Debug/playground.build/Objects-normal/x86_64/playground_lto.o -Xlinker -no_deduplicate -Wl,-search_paths_first -Wl,-headerpad_max_install_names -framework OpenGL -framework OpenGL /Users/RufusVijayaratnam/rufus/Coding/OpenGL/external/glfw-3.1.2/src/Debug/libglfw3.a /Users/RufusVijayaratnam/rufus/Coding/OpenGL/external/Debug/libGLEW_1130.a -framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo -Xlinker -dependency_info -Xlinker /Users/RufusVijayaratnam/rufus/Coding/OpenGL/Tutorials.build/Debug/playground.build/Objects-normal/x86_64/playground_dependency_info.dat -o /Users/RufusVijayaratnam/rufus/Coding/ogl-master/playground/playground
所以错误似乎是当调用函数loadDDS()
时找不到它。我不确定这是为什么。该函数在文件夹(名为 'common')中的 texture.ccp
中与 texture.hpp
一起声明。 texture.hpp
有以下代码:
#ifndef TEXTURE_HPP
#define TEXTURE_HPP
// Load a .DDS file using GLFW's own loader
GLuint loadDDS(const char * imagepath);
#endif
在playground.cpp
中有:
include<texture.hpp>
为什么找不到loadDDS()
,虽然我把playground函数的工作目录设置成和教程5一样,playground.ccp
和[=中的代码37=]一模一样?
for the playground executable (doesn't work)
# User playground add_executable(playground
playground/playground.cpp
common/shader.cpp
common/shader.hpp )
and finally for tutorial 5 (does work)
# Tutorial 5
add_executable(tutorial05_textured_cube
tutorial05_textured_cube/tutorial05.cpp
common/shader.cpp
common/shader.hpp
common/texture.cpp
common/texture.hpp
所以我有根据地猜测 loadDDS()
是在 texture.cpp
中实现的,并且由于你没有添加这个文件,它不会被编译,并且生成的目标文件获胜' 被链接,符号将找不到。
我一直在学习 OpenGL-tutorial.org 教程系列。一切都运行良好,但是我无法让教程 5 在我的 playground 可执行文件中运行,尽管它在示例教程 5 可执行文件中 运行 时确实有效。即使我复制并粘贴示例代码也是如此。
我收到以下错误:
Undefined symbols for architecture x86_64:
"loadDDS(char const*)", referenced from:
_main in playground.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
下面是 link 日志:
Ld playground/playground normal x86_64
cd /Users/RufusVijayaratnam/rufus/Coding/ogl-master
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-macos10.15 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/RufusVijayaratnam/rufus/Coding/ogl-master/playground -F/Users/RufusVijayaratnam/rufus/Coding/ogl-master/playground -filelist /Users/RufusVijayaratnam/rufus/Coding/OpenGL/Tutorials.build/Debug/playground.build/Objects-normal/x86_64/playground.LinkFileList -Xlinker -object_path_lto -Xlinker /Users/RufusVijayaratnam/rufus/Coding/OpenGL/Tutorials.build/Debug/playground.build/Objects-normal/x86_64/playground_lto.o -Xlinker -no_deduplicate -Wl,-search_paths_first -Wl,-headerpad_max_install_names -framework OpenGL -framework OpenGL /Users/RufusVijayaratnam/rufus/Coding/OpenGL/external/glfw-3.1.2/src/Debug/libglfw3.a /Users/RufusVijayaratnam/rufus/Coding/OpenGL/external/Debug/libGLEW_1130.a -framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo -Xlinker -dependency_info -Xlinker /Users/RufusVijayaratnam/rufus/Coding/OpenGL/Tutorials.build/Debug/playground.build/Objects-normal/x86_64/playground_dependency_info.dat -o /Users/RufusVijayaratnam/rufus/Coding/ogl-master/playground/playground
所以错误似乎是当调用函数loadDDS()
时找不到它。我不确定这是为什么。该函数在文件夹(名为 'common')中的 texture.ccp
中与 texture.hpp
一起声明。 texture.hpp
有以下代码:
#ifndef TEXTURE_HPP
#define TEXTURE_HPP
// Load a .DDS file using GLFW's own loader
GLuint loadDDS(const char * imagepath);
#endif
在playground.cpp
中有:
include<texture.hpp>
为什么找不到loadDDS()
,虽然我把playground函数的工作目录设置成和教程5一样,playground.ccp
和[=中的代码37=]一模一样?
for the playground executable (doesn't work)
# User playground add_executable(playground playground/playground.cpp common/shader.cpp common/shader.hpp )
and finally for tutorial 5 (does work)
# Tutorial 5 add_executable(tutorial05_textured_cube tutorial05_textured_cube/tutorial05.cpp common/shader.cpp common/shader.hpp common/texture.cpp common/texture.hpp
所以我有根据地猜测 loadDDS()
是在 texture.cpp
中实现的,并且由于你没有添加这个文件,它不会被编译,并且生成的目标文件获胜' 被链接,符号将找不到。