我想在我的Mac和Xcode使用GLFW 2.7.5,但我发现了以下错误:链接错误当试图编译GLFW在Mac
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)
我读过这Problems using GLFW and XCode : won't compile和互联网上的其他几个链接,但我找不到解决方案。
我设置了Cocoa框架,OpenGL框架和libglfw.a(我编译时使用“sudo make cocoa-install”),在链接器标志中设置了-lgflw,我正在为32位构建英特尔。起初,我正在构建一个64位,但我认为GLFW不支持在Mac上(但我得到的游戏杆文件错误),错误改变时,我编译为32位,它无法找到函数I正在使用。任何想法我可以做什么来解决这个问题?
当你建立'libglfw.a'你建立它的32位或64位?使用'file libglfw.a'来检查它是否是32位。 –
这是64位(我不得不使用“文件”的“lipo -info”实例)。有没有办法将它从64位机器上升到32位? –
您需要阅读README,docs,makefile或任何libglfw以了解如何构建32位版本。另外,你可以建立你的应用程序为64位而不是32位。 –