首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >“建筑arm64的未定义符号”

“建筑arm64的未定义符号”
EN

Stack Overflow用户
提问于 2022-07-27 18:24:57
回答 1查看 655关注 0票数 2

我最近买了一本M1 Macbook,并试图编写C++代码。我创建了一个带有main.cpp、makefile和lib文件夹的简单项目,其中包含两个头文件。

main.cpp:

代码语言:javascript
运行
复制
#include <iostream>
#include "lib/GLFW/glfw3.h"

#define GL_SILENCE_DEPRECATION

int main() {
    GLFWwindow* window;

    if (!glfwInit()){
        exit(EXIT_FAILURE);
    }

    window = glfwCreateWindow(640, 480, "Test Window by Jonny", NULL, NULL);
    if (!window) {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }

    glfwMakeContextCurrent(window);


    glfwDestroyWindow(window);
    glfwTerminate();
    exit(EXIT_SUCCESS);
}

makefile:

代码语言:javascript
运行
复制
.DEFAULT_GOAL=main

main:
    clang++ main.cpp -I./lib/GLFW/ -o main

现在,如果我试图使用make从终端运行makefile,则得到以下错误输出:

代码语言:javascript
运行
复制
solon  20:17  ~/D/0/C/_/Graphics  > make
clang++ main.cpp -I./lib/GLFW/ -o main
Undefined symbols for architecture arm64:
  "_glfwCreateWindow", referenced from:
      _main in main-928db7.o
  "_glfwDestroyWindow", referenced from:
      _main in main-928db7.o
  "_glfwInit", referenced from:
      _main in main-928db7.o
  "_glfwMakeContextCurrent", referenced from:
      _main in main-928db7.o
  "_glfwTerminate", referenced from:
      _main in main-928db7.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main] Error 1

如果删除makefile并让VS代码处理clang内容,我会得到同样的错误。有人知道该怎么做吗,这真的会有很大帮助。

向Solon问好

EN

回答 1

Stack Overflow用户

发布于 2022-07-27 18:47:23

因此,我重新下载了预编译的GLFW二进制文件,并将makefile更改为:

代码语言:javascript
运行
复制
.DEFAULT_GOAL=main

main:
    clang++ main.cpp -I./lib/GLFW/include/ -L./lib/GLFW/lib-arm64/ -lglfw3 -o main

另外,我的内容是现在(仅作为附带说明):

代码语言:javascript
运行
复制
#include "lib/GLFW/include/GLFW/glfw3.h"

不,错误消息是:

代码语言:javascript
运行
复制
clang++ main.cpp -I./lib/GLFW/include/ -L./lib/GLFW/lib-arm64/ -lglfw3 -o main
Undefined symbols for architecture arm64:
  "_CFArrayAppendValue", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_CFArrayCreateMutable", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_CFArrayGetCount", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
      _closeJoystick in libglfw3.a(cocoa_joystick.m.o)
      __glfwPlatformPollJoystick in libglfw3.a(cocoa_joystick.m.o)
  "_CFArrayGetValueAtIndex", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
      _closeJoystick in libglfw3.a(cocoa_joystick.m.o)
      __glfwPlatformPollJoystick in libglfw3.a(cocoa_joystick.m.o)
  "_CFArraySortValues", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_CFBundleCopyPrivateFrameworksURL", referenced from:
      __glfwLoadLocalVulkanLoaderNS in libglfw3.a(cocoa_init.m.o)
  "_CFBundleCopyResourcesDirectoryURL", referenced from:
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
  "_CFBundleGetBundleWithIdentifier", referenced from:
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
      __glfwInitNSGL in libglfw3.a(nsgl_context.m.o)
  "_CFBundleGetDataPointerForName", referenced from:
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
  "_CFBundleGetFunctionPointerForName", referenced from:
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
      _getProcAddressNSGL in libglfw3.a(nsgl_context.m.o)
  "_CFBundleGetMainBundle", referenced from:
      __glfwLoadLocalVulkanLoaderNS in libglfw3.a(cocoa_init.m.o)
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
  "_CFDictionaryCreateMutable", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_CFDictionaryGetValue", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CFDictionaryGetValueIfPresent", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CFDictionarySetValue", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_CFGetTypeID", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_CFNumberCreate", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_CFNumberGetValue", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_CFRelease", referenced from:
      __glfwPlatformGetScancodeName in libglfw3.a(cocoa_window.m.o)
      -[GLFWHelper selectedKeyboardInputSourceChanged:] in libglfw3.a(cocoa_init.m.o)
      __glfwLoadLocalVulkanLoaderNS in libglfw3.a(cocoa_init.m.o)
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
      __glfwPlatformTerminate in libglfw3.a(cocoa_init.m.o)
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      ...
  "_CFRunLoopGetMain", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_CFRunLoopRunInMode", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_CFStringCompare", referenced from:
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
  "_CFStringCreateWithCString", referenced from:
      _getProcAddressNSGL in libglfw3.a(nsgl_context.m.o)
  "_CFStringCreateWithCharactersNoCopy", referenced from:
      __glfwPlatformGetScancodeName in libglfw3.a(cocoa_window.m.o)
  "_CFStringGetCString", referenced from:
      __glfwPlatformGetScancodeName in libglfw3.a(cocoa_window.m.o)
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_CFStringGetLength", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CFStringGetMaximumSizeForEncoding", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CFURLCopyLastPathComponent", referenced from:
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
  "_CFURLCreateCopyAppendingPathComponent", referenced from:
      __glfwLoadLocalVulkanLoaderNS in libglfw3.a(cocoa_init.m.o)
  "_CFURLGetFileSystemRepresentation", referenced from:
      __glfwLoadLocalVulkanLoaderNS in libglfw3.a(cocoa_init.m.o)
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
  "_CGAcquireDisplayFadeReservation", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwRestoreVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGAssociateMouseAndMouseCursorPosition", referenced from:
      _updateCursorMode in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformSetCursorPos in libglfw3.a(cocoa_window.m.o)
  "_CGDisplayBounds", referenced from:
      -[GLFWWindowDelegate windowDidMove:] in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformGetWindowPos in libglfw3.a(cocoa_window.m.o)
      -[GLFWWindowDelegate windowDidDeminiaturize:] in libglfw3.a(cocoa_window.m.o)
      __glfwTransformYNS in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformCreateWindow in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformSetWindowPos in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformSetWindowSize in libglfw3.a(cocoa_window.m.o)
      ...
  "_CGDisplayCopyAllDisplayModes", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayCopyDisplayMode", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayFade", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwRestoreVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayGammaTableCapacity", referenced from:
      __glfwPlatformGetGammaRamp in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayIsAsleep", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayModeGetHeight", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayModeGetIOFlags", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayModeGetRefreshRate", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayModeGetWidth", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayModeRelease", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
      __glfwRestoreVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayModelNumber", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayMoveCursorToPoint", referenced from:
      __glfwPlatformSetCursorPos in libglfw3.a(cocoa_window.m.o)
  "_CGDisplayScreenSize", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplaySetDisplayMode", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwRestoreVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayUnitNumber", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGDisplayVendorNumber", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGEventSourceCreate", referenced from:
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
  "_CGEventSourceSetLocalEventsSuppressionInterval", referenced from:
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
  "_CGGetDisplayTransferByTable", referenced from:
      __glfwPlatformGetGammaRamp in libglfw3.a(cocoa_monitor.m.o)
  "_CGGetOnlineDisplayList", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGMainDisplayID", referenced from:
      -[GLFWWindowDelegate windowDidMove:] in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformGetWindowPos in libglfw3.a(cocoa_window.m.o)
      -[GLFWWindowDelegate windowDidDeminiaturize:] in libglfw3.a(cocoa_window.m.o)
      __glfwTransformYNS in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformCreateWindow in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformSetWindowPos in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformSetWindowSize in libglfw3.a(cocoa_window.m.o)
      ...
  "_CGOpenGLDisplayMaskToDisplayID", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGReleaseDisplayFadeReservation", referenced from:
      __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
      __glfwRestoreVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
  "_CGSetDisplayTransferByTable", referenced from:
      __glfwPlatformSetGammaRamp in libglfw3.a(cocoa_monitor.m.o)
  "_CGWarpMouseCursorPosition", referenced from:
      __glfwPlatformSetCursorPos in libglfw3.a(cocoa_window.m.o)
  "_IODisplayCreateInfoDictionary", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_IOHIDDeviceCopyMatchingElements", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDDeviceGetProperty", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDDeviceGetValue", referenced from:
      __glfwPlatformPollJoystick in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDElementGetLogicalMax", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDElementGetLogicalMin", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDElementGetType", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDElementGetTypeID", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDElementGetUsage", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDElementGetUsagePage", referenced from:
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDManagerCreate", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDManagerOpen", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDManagerRegisterDeviceMatchingCallback", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDManagerRegisterDeviceRemovalCallback", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDManagerScheduleWithRunLoop", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDManagerSetDeviceMatchingMultiple", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_IOHIDValueGetIntegerValue", referenced from:
      __glfwPlatformPollJoystick in libglfw3.a(cocoa_joystick.m.o)
  "_IOIteratorNext", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_IOObjectRelease", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_IORegistryEntryCreateCFProperty", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_IOServiceGetMatchingServices", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_IOServiceMatching", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_NSApp", referenced from:
      -[GLFWContentView insertText:replacementRange:] in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformCreateWindow in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformFocusWindow in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformPollEvents in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformRequestWindowAttention in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformWaitEvents in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformWaitEventsTimeout in libglfw3.a(cocoa_window.m.o)
      ...
     (maybe you meant: __OBJC_LABEL_PROTOCOL_$_NSApplicationDelegate, __OBJC_PROTOCOL_$_NSApplicationDelegate )
  "_NSCalibratedRGBColorSpace", referenced from:
      __glfwPlatformCreateCursor in libglfw3.a(cocoa_window.m.o)
  "_NSDefaultRunLoopMode", referenced from:
      __glfwPlatformPollEvents in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformWaitEvents in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformWaitEventsTimeout in libglfw3.a(cocoa_window.m.o)
  "_NSMouseInRect", referenced from:
      __glfwPlatformWindowHovered in libglfw3.a(cocoa_window.m.o)
  "_NSPasteboardTypeString", referenced from:
      __glfwPlatformSetClipboardString in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformGetClipboardString in libglfw3.a(cocoa_window.m.o)
  "_NSPasteboardURLReadingFileURLsOnlyKey", referenced from:
      -[GLFWContentView performDragOperation:] in libglfw3.a(cocoa_window.m.o)
  "_NSSelectorFromString", referenced from:
      -[GLFWApplicationDelegate applicationWillFinishLaunching:] in libglfw3.a(cocoa_init.m.o)
  "_NSTextInputContextKeyboardSelectionDidChangeNotification", referenced from:
      __glfwPlatformInit in libglfw3.a(cocoa_init.m.o)
      __glfwPlatformTerminate in libglfw3.a(cocoa_init.m.o)
  "_NSURLPboardType", referenced from:
      -[GLFWContentView initWithGlfwWindow:] in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSApplication", referenced from:
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSArray", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSAttributedString", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSBitmapImageRep", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSBundle", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSColor", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSCursor", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSDate", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSDictionary", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSEvent", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSImage", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSMenu", referenced from:
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSMenuItem", referenced from:
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSMutableAttributedString", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSNotificationCenter", referenced from:
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSNumber", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSObject", referenced from:
      _OBJC_CLASS_$_GLFWWindowDelegate in libglfw3.a(cocoa_window.m.o)
      _OBJC_CLASS_$_GLFWHelper in libglfw3.a(cocoa_init.m.o)
      _OBJC_CLASS_$_GLFWApplicationDelegate in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSOpenGLContext", referenced from:
      objc-class-ref in libglfw3.a(nsgl_context.m.o)
  "_OBJC_CLASS_$_NSOpenGLPixelFormat", referenced from:
      objc-class-ref in libglfw3.a(nsgl_context.m.o)
  "_OBJC_CLASS_$_NSPasteboard", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSScreen", referenced from:
      objc-class-ref in libglfw3.a(cocoa_monitor.m.o)
  "_OBJC_CLASS_$_NSString", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSThread", referenced from:
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSTrackingArea", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSURL", referenced from:
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSUserDefaults", referenced from:
      objc-class-ref in libglfw3.a(cocoa_init.m.o)
  "_OBJC_CLASS_$_NSView", referenced from:
      _OBJC_CLASS_$_GLFWContentView in libglfw3.a(cocoa_window.m.o)
  "_OBJC_CLASS_$_NSWindow", referenced from:
      _OBJC_CLASS_$_GLFWWindow in libglfw3.a(cocoa_window.m.o)
      objc-class-ref in libglfw3.a(cocoa_window.m.o)
  "_OBJC_METACLASS_$_NSObject", referenced from:
      _OBJC_METACLASS_$_GLFWWindowDelegate in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWContentView in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWWindow in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWHelper in libglfw3.a(cocoa_init.m.o)
      _OBJC_METACLASS_$_GLFWApplicationDelegate in libglfw3.a(cocoa_init.m.o)
  "_OBJC_METACLASS_$_NSView", referenced from:
      _OBJC_METACLASS_$_GLFWContentView in libglfw3.a(cocoa_window.m.o)
  "_OBJC_METACLASS_$_NSWindow", referenced from:
      _OBJC_METACLASS_$_GLFWWindow in libglfw3.a(cocoa_window.m.o)
  "_UCKeyTranslate", referenced from:
      __glfwPlatformGetScancodeName in libglfw3.a(cocoa_window.m.o)
  "___CFConstantStringClassReference", referenced from:
      CFString in libglfw3.a(cocoa_window.m.o)
      CFString in libglfw3.a(cocoa_window.m.o)
      CFString in libglfw3.a(cocoa_window.m.o)
      CFString in libglfw3.a(cocoa_init.m.o)
      CFString in libglfw3.a(cocoa_init.m.o)
      CFString in libglfw3.a(cocoa_init.m.o)
      CFString in libglfw3.a(cocoa_init.m.o)
      ...
  "__objc_empty_cache", referenced from:
      _OBJC_CLASS_$_GLFWWindowDelegate in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWWindowDelegate in libglfw3.a(cocoa_window.m.o)
      _OBJC_CLASS_$_GLFWContentView in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWContentView in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWWindow in libglfw3.a(cocoa_window.m.o)
      _OBJC_CLASS_$_GLFWWindow in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWHelper in libglfw3.a(cocoa_init.m.o)
      ...
  "__objc_empty_vtable", referenced from:
      _OBJC_CLASS_$_GLFWWindowDelegate in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWWindowDelegate in libglfw3.a(cocoa_window.m.o)
      _OBJC_CLASS_$_GLFWContentView in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWContentView in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWWindow in libglfw3.a(cocoa_window.m.o)
      _OBJC_CLASS_$_GLFWWindow in libglfw3.a(cocoa_window.m.o)
      _OBJC_METACLASS_$_GLFWHelper in libglfw3.a(cocoa_init.m.o)
      ...
  "_kCFAllocatorDefault", referenced from:
      __glfwPlatformGetScancodeName in libglfw3.a(cocoa_window.m.o)
      __glfwLoadLocalVulkanLoaderNS in libglfw3.a(cocoa_init.m.o)
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
      _getProcAddressNSGL in libglfw3.a(nsgl_context.m.o)
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_kCFAllocatorNull", referenced from:
      __glfwPlatformGetScancodeName in libglfw3.a(cocoa_window.m.o)
  "_kCFRunLoopDefaultMode", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_kCFTypeArrayCallBacks", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_kCFTypeDictionaryKeyCallBacks", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_kCFTypeDictionaryValueCallBacks", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
  "_objc_autoreleasePoolPop", referenced from:
      -[GLFWWindowDelegate windowDidMove:] in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformGetWindowPos in libglfw3.a(cocoa_window.m.o)
      _updateCursorMode in libglfw3.a(cocoa_window.m.o)
      -[GLFWWindowDelegate windowDidResignKey:] in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformIconifyWindow in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformCreateWindow in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformShowWindow in libglfw3.a(cocoa_window.m.o)
      ...
  "_objc_autoreleasePoolPush", referenced from:
      -[GLFWWindowDelegate windowDidMove:] in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformGetWindowPos in libglfw3.a(cocoa_window.m.o)
      _updateCursorMode in libglfw3.a(cocoa_window.m.o)
      -[GLFWWindowDelegate windowDidResignKey:] in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformIconifyWindow in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformCreateWindow in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformShowWindow in libglfw3.a(cocoa_window.m.o)
      ...
  "_objc_enumerationMutation", referenced from:
      __glfwPollMonitorsNS in libglfw3.a(cocoa_monitor.m.o)
  "_objc_msgSend", referenced from:
      -[GLFWWindowDelegate windowDidResize:] in libglfw3.a(cocoa_window.m.o)
      -[GLFWWindowDelegate windowDidMove:] in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformGetWindowPos in libglfw3.a(cocoa_window.m.o)
      -[GLFWWindowDelegate windowDidDeminiaturize:] in libglfw3.a(cocoa_window.m.o)
      _updateCursorMode in libglfw3.a(cocoa_window.m.o)
      -[GLFWWindowDelegate windowDidResignKey:] in libglfw3.a(cocoa_window.m.o)
      __glfwPlatformIconifyWindow in libglfw3.a(cocoa_window.m.o)
      ...
  "_objc_msgSendSuper2", referenced from:
      -[GLFWWindowDelegate initWithGlfwWindow:] in libglfw3.a(cocoa_window.m.o)
      -[GLFWContentView initWithGlfwWindow:] in libglfw3.a(cocoa_window.m.o)
      -[GLFWContentView dealloc] in libglfw3.a(cocoa_window.m.o)
      -[GLFWContentView updateTrackingAreas] in libglfw3.a(cocoa_window.m.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main] Error 1

我并没有因此变得更聪明。我现在也链接了这个库,不仅告诉编译器搜索包含的位置。

编辑

我再次将makefile更改为:

代码语言:javascript
运行
复制
.DEFAULT_GOAL=main

main:
    clang++ main.cpp -I./lib/GLFW/include/ -L./lib/GLFW/lib-arm64/ -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -o main

现在起作用了。所需的框架是在MacOS中预先安装的,因此无需安装就可以使用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73142912

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档