[英]GLFW linking issue in makefile on OSX Lion
我已经读过这篇文章,但这对我来说似乎是一个不同的问题。
在makefile中运行的命令是,
g++ -o main main.cpp -lglfw -framework Cocoa -framework OpenGL
我运行makefile时收到的错误是,
Undefined symbols for architecture x86_64:
"_IOMasterPort", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOServiceMatching", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOServiceGetMatchingServices", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOIteratorNext", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IORegistryEntryCreateCFProperties", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOCreatePlugInInterfaceForService", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [all] Error 1
将-framework IOKit
添加到g ++选项。
感谢@MārtiņšMožeiko,我解决了部分问题,但对我来说仍有一些错误消息:
Undefined symbols for architecture x86_64:
"_CVDisplayLinkCreateWithCGDisplay", referenced from:
__glfwSetVideoMode in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
"_CVDisplayLinkGetNominalOutputVideoRefreshPeriod", referenced from:
_vidmodeFromCGDisplayMode in libglfw3.a(cocoa_monitor.m.o)
"_CVDisplayLinkRelease", referenced from:
__glfwSetVideoMode in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [scop] Error 1
make: *** [scop] Error 2
为了解决这个问题,我还需要添加CoreVideo框架。
-framework Cocoa -framework IOKit -framework CoreVideo -framework OpenGL
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.