我想在我的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位。 –