简体   繁体   中英

GLFW "Undefined symbols for architecture arm64"

I recently got a M1 Macbook and am trying to write C++ Code. I created a simple project with a main.cpp a makefile and a lib Folder with an GLFW Folder in it with two Header Files.

main.cpp:

#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:

.DEFAULT_GOAL=main

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

Now if I'm trying to run the makefile from the Terminal with make I get the following Error-Output:

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

I get the same error, if I delete the makefile and let VS Code handle the clang stuff. Does somebody have an idea what to do, it would really help a lot.

Best Regards Solon

So I redownloaded the precompiled GLFW-Mac-Binaries, and changed my makefile to the following:

.DEFAULT_GOAL=main

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

Also my include is now (Only as side note tho):

#include "lib/GLFW/include/GLFW/glfw3.h"

No the error message is:

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

I didn't really get any smarter from that. I now linked the library as well and didn't only tell the compiler where to search for includes.

EDIT

I changed the makefile once again to:

.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

And now it works. The needed frameworks are preinstalled in MacOS and can therefore be used without any installs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM