我正在尝试在带有 xcode 的 Mac 上使用 glfw 2.7.5,但出现以下错误:
Undefined symbols for architecture i386:
"_glfwGetKey", referenced from:
Game::run() in Game.o
RedScene::update(float, bool) in main.o
"_glfwGetWindowParam", referenced from:
Game::run() in Game.o
"_glfwInit", referenced from:
Window::Window() in Window.o
"_glfwOpenWindow", referenced from:
createWindow(int, int, int, int, int, int, int, int) in Window.o
"_glfwOpenWindowHint", referenced from:
Window::Window() in Window.o
"_glfwPollEvents", referenced from:
Game::run() in Game.o
"_glfwSetKeyCallback", referenced from:
createWindow(int, int, int, int, int, int, int, int) in Window.o
"_glfwSetMouseButtonCallback", referenced from:
createWindow(int, int, int, int, int, int, int, int) in Window.o
"_glfwSetMousePosCallback", referenced from:
createWindow(int, int, int, int, int, int, int, int) in Window.o
"_glfwSetMouseWheelCallback", referenced from:
createWindow(int, int, int, int, int, int, int, int) in Window.o
"_glfwSetWindowTitle", referenced from:
Window::setCaption(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Window.o
"_glfwSwapBuffers", referenced from:
RedScene::update(float, bool) in main.o
"_glfwSwapInterval", referenced from:
createWindow(int, int, int, int, int, int, int, int) in Window.o
"_glfwTerminate", referenced from:
Window::~Window() in Window.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我已经阅读了使用 GLFW 和 XCode 的问题:将无法编译以及互联网上的其他几个链接,但我找不到解决方案。
我已经设置了 Cocoa 框架、OpenGL 框架和 libglfw.a(我使用“sudo make cocoa-install”编译),在我设置 -lgflw 的链接器标志中,我正在为 32 位英特尔构建。起初我是为 64 位构建的,但我认为 GLFW 在 Mac 上还不支持它(我遇到了操纵杆文件错误),当我编译为 32 位时错误发生了变化,它找不到我的功能正在使用。知道我能做些什么来解决这个问题吗?