gpt4 book ai didi

c++ - 使用 GLFW3 编译,链接器错误 'undefined reference'

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:52:58 24 4
gpt4 key购买 nike

有一个使用 GLFW3 的最小示例:

#include <GLFW/glfw3.h>

int main(int argc, const char * argv[]) {
glfwInit();
}

...导致大量链接器错误:(小摘录)

Undefined symbols for architecture x86_64:
"_CFArrayAppendValue", referenced from:
_addJoystickElement in libglfw3.a(cocoa_joystick.m.o)
"_CFArrayApplyFunction", referenced from:
__glfwInitJoysticks in libglfw3.a(cocoa_joystick.m.o)
_addJoystickElement in libglfw3.a(cocoa_joystick.m.o)
"_CFArrayCreateMutable", referenced from:
__glfwInitJoysticks in libglfw3.a(cocoa_joystick.m.o)

...

"_objc_msgSend_fixup", referenced from:
l_objc_msgSend_fixup_count in libglfw3.a(cocoa_monitor.m.o)
l_objc_msgSend_fixup_objectAtIndex_ in libglfw3.a(cocoa_monitor.m.o)
l_objc_msgSend_fixup_objectForKey_ in libglfw3.a(cocoa_monitor.m.o)
l_objc_msgSend_fixup_alloc in libglfw3.a(cocoa_init.m.o)
l_objc_msgSend_fixup_release in libglfw3.a(cocoa_init.m.o)
l_objc_msgSend_fixup_alloc in libglfw3.a(nsgl_context.m.o)
l_objc_msgSend_fixup_release in libglfw3.a(nsgl_context.m.o)
...

OpenGL.frameworklibglfw3.a 都是链接的。

enter image description here

这是什么原因?之前编译一个 glfw2 应用程序就像一个魅力。

最佳答案

关于c++ - 使用 GLFW3 编译,链接器错误 'undefined reference',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18391487/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com