Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. "Undefined symbols" linking to external library [Mac]
Qt 6.11 is out! See what's new in the release blog

"Undefined symbols" linking to external library [Mac]

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 4 Posters 5.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi all,
    I've added a library to my .pro

    @macx: LIBS += $$PWD/fbx/lib/libfbxsdk-2013.1-staticd.a@

    which is respected, as the log from the build shows:

    @14:56:41: Starting: "/usr/bin/make" -w
    make: Entering directory `/Users/mlaff/Projects/MicaC++-build-desktop-Desktop_Qt_4_8_0_for_GCC__Qt_SDK__Debug'
    g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o MicaC++.app/Contents/MacOS/MicaC++ MicaApp.o MainWidget.o FbxContext.o PreviewWidget.o PlayerControlWidget.o QtGlContext.o FbxSceneRenderer.o moc_MicaApp.o moc_MainWidget.o moc_PreviewWidget.o moc_PlayerControlWidget.o -F/Users/mlaff/QtSDK/Desktop/Qt/4.8.0/gcc/lib -L/Users/mlaff/QtSDK/Desktop/Qt/4.8.0/gcc/lib /Users/mlaff/Projects/MicaQt/fbx/lib/libfbxsdk-2013.1-staticd.a -framework QtOpenGL -framework QtGui -framework QtCore -framework OpenGL -framework AGL @

    but I get "Undefined symbols:"

    @Undefined symbols:
    "fbxsdk_2012_2::KFbxIOSettings::Create(fbxsdk_2012_2::KFbxSdkManager*, char const*)", referenced from:
    InitializeSdkObjects(fbxsdk_2012_2::KFbxSdkManager*&, fbxsdk_2012_2::KFbxScene*&)in FbxContext.o
    "fbxsdk_2012_2::KFbxIOSettings::SetBoolProp(char const*, bool)", referenced from:
    LoadScene(fbxsdk_2012_2::KFbxSdkManager*, fbxsdk_2012_2::KFbxDocument*, char const*)in FbxContext.o...@

    If I look at the ".a" file for this library, I see what looks like the correct entry point defined:
    @{mlaff@YP-0013-mlaff:503} nm /Users/mlaff/Projects/MicaQt/fbx/lib/libfbxsdk-2013.1-staticd.a | grep SetBoolProp
    nm: no name list
    00000000000048b4 T __ZN13fbxsdk_2013_113FbxIOSettings11SetBoolPropEPKcb
    00000000000477f8 S __ZN13fbxsdk_2013_113FbxIOSettings11SetBoolPropEPKcb.eh
    00000000000456a7 s ZZN13fbxsdk_2013_113FbxIOSettings11SetBoolPropEPKcbE12__FUNCTION
    U __ZN13fbxsdk_2013_113FbxIOSettings11SetBoolPropEPKcb
    U __ZN13fbxsdk_2013_113FbxIOSettings11SetBoolPropEPKcb
    U __ZN13fbxsdk_2013_113FbxIOSettings11SetBoolPropEPKcb
    U __ZN13fbxsdk_2013_113FbxIOSettings11SetBoolPropEPKcb
    U __ZN13fbxsdk_2013_113FbxIOSettings11SetBoolPropEPKcb
    U __ZN13fbxsdk_2013_113FbxIOSettings11SetBoolPropEPKcb
    @

    This is on Mac OS X with Qt Creator 2.4.1.

    I'm new to Qt, and I tried to search out prior answers to no avail, but apologies in advance if this is a common question.

    Thanks,

    Mark

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Does the static lib contain the correct architecture? It must at least have all the version that your application is compiled against.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Here is the description for the library I'm using (the Autodesk FBX SDK)

        bq. <yourFBXSDKpath>\lib\gcc4\ub\fbxsdk-2013-staticd.a gcc 4.0 compiler, static library, debug, Intel 32-bit (i386) and Intel 64-bit (x86_64)

        and I believe the following indicates that both architectures are included:

        bq. {mlaff@YP-0013-mlaff:508} file libfbxsdk-2013.1-staticd.a
        libfbxsdk-2013.1-staticd.a: Mach-O universal binary with 2 architectures
        libfbxsdk-2013.1-staticd.a (for architecture i386): current ar archive random library
        libfbxsdk-2013.1-staticd.a (for architecture x86_64): current ar archive random library

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Would you try prefixing -l to the LIBS variable like below?

          @
          macx: LIBS += -l$$PWD/fbx/lib/libfbxsdk-2013.1-staticd.a
          @

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            I think I've made the change you suggested, but now the compile can't find the library at all.

            Updated .pro:

            @macx: LIBS += -l$$PWD/fbx/lib/libfbxsdk-2013.1-staticd.a@

            but it looks like it is looking at a path with the "-l" at the head, not treating it as an option.

            @01:03:49: Running build steps for project MicaC++...
            01:03:49: Configuration unchanged, skipping qmake step.
            01:03:49: Starting: "/usr/bin/make" -w
            make: Entering directory /Users/mlaff/Projects/MicaC++-build-desktop-Desktop_Qt_4_8_0_for_GCC__Qt_SDK__Debug' /Users/mlaff/QtSDK/Desktop/Qt/4.8.0/gcc/bin/qmake -spec ../../QtSDK/Desktop/Qt/4.8.0/gcc/mkspecs/macx-g++ CONFIG+=declarative_debug -o Makefile ../MicaQt/MicaC++.pro make: Leaving directory /Users/mlaff/Projects/MicaC++-build-desktop-Desktop_Qt_4_8_0_for_GCC__Qt_SDK__Debug'
            make: Entering directory /Users/mlaff/Projects/MicaC++-build-desktop-Desktop_Qt_4_8_0_for_GCC__Qt_SDK__Debug' g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o MicaC++.app/Contents/MacOS/MicaC++ MicaApp.o MainWidget.o FbxContext.o PreviewWidget.o PlayerControlWidget.o QtGlContext.o FbxSceneRenderer.o moc_MicaApp.o moc_MainWidget.o moc_PreviewWidget.o moc_PlayerControlWidget.o -F/Users/mlaff/QtSDK/Desktop/Qt/4.8.0/gcc/lib -L/Users/mlaff/QtSDK/Desktop/Qt/4.8.0/gcc/lib -l/Users/mlaff/Projects/MicaQt/fbx/lib/libfbxsdk-2013.1-staticd.a -framework QtOpenGL -framework QtGui -framework QtCore -framework OpenGL -framework AGL ld: library not found for -l/Users/mlaff/Projects/MicaQt/fbx/lib/libfbxsdk-2013.1-staticd.a collect2: ld returned 1 exit status make: *** [MicaC++.app/Contents/MacOS/MicaC++] Error 1 make: Leaving directory /Users/mlaff/Projects/MicaC++-build-desktop-Desktop_Qt_4_8_0_for_GCC__Qt_SDK__Debug'
            01:03:51: The process "/usr/bin/make" exited with code 2.
            Error while building project MicaC++ (target: Desktop)
            When executing build step 'Make'@

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              Pardon me, I think what you done previously is correct, since this is a static library.
              @macx: LIBS += $$PWD/fbx/lib/libfbxsdk-2013.1-staticd.a@

              unfortunately I am not sure why this is giving un-resolved symbols, since you mentioned that this is having correct architecture as well.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sptrakesh
                wrote on last edited by
                #7

                For checking the library try using otool (eg. otool -hv) and see if it reveals anything extra.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved