Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Strange Linking Error
QtWS25 Last Chance

Strange Linking Error

Scheduled Pinned Locked Moved General and Desktop
13 Posts 2 Posters 3.0k Views
  • 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.
  • D Offline
    D Offline
    DRoscoe
    wrote on last edited by
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Is your library linked to the application?

      Are you using QMake/CMake/Qbs to build? can you post the project file??

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DRoscoe
        wrote on last edited by
        #3

        I am not using Qbs. I am using qmake. Here is the project file:

        #-------------------------------------------------

        Project created by QtCreator 2015-03-05T10:35:37

        #-------------------------------------------------

        include(../top_srcdir.pri)
        #include(../ace_path.pri)
        #include(../dna.pri) # defines dna dependency
        #include(../configuration.pri) # defines configuration dependency
        #include(../AvionicsBus.pri) # defines AvionicsBus dependency
        #include(../aop_comm.pri)
        #include(../aop_measure.pri)
        #include(../aop_data.pri)
        #include(../aop_logger.pri)
        #include(../aop_serial.pri)
        #include(../aop_util.pri)
        #include(../aop_xml.pri)

        QT -= core gui

        TARGET = aop_interface
        TEMPLATE = lib
        CONFIG += staticlib c++11 create_prl link_prl

        INCLUDEPATH =
        $$aop_interface_includes
        $$avionics_bus_includes
        $$dna_includes
        $$aop_measure_includes
        $$aop_data_includes
        $$route_container_includes
        $$aop_serial_includes
        $$aop_util_includes
        $$aop_logger_includes
        $$aop_comm_includes
        $$configuration_includes
        $$aop_xml_includes
        include(../ace_path.pri)
        include(../dna.pri)
        SOURCES += $$files($$aop_srcdir/core/aop_interface/.cpp, true)
        HEADERS += $$files($$aop_srcdir/core/aop_interface/
        .hpp, true)

        unix {
        target.path = /usr/lib
        INSTALLS += target
        }

        This project file brings in dna.pri which defines an internal library dependency:

        include(top_srcdir.pri)

        win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../dna/release/ -ldna
        else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../dna/debug/ -ldna
        else:unix: LIBS += -L$$OUT_PWD/../dna/ -ldna

        INCLUDEPATH += $$aop_srcdir/core/dna
        DEPENDPATH += $$aop_srcdir/core/dna

        win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../dna/release/libdna.a
        else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../dna/debug/libdna.a
        else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../dna/release/dna.lib
        else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../dna/debug/dna.lib
        else:unix: PRE_TARGETDEPS += $$OUT_PWD/../dna/libdna.a

        Its this library where Repository exists, which is the class the error is complaining about. I've confirmed that Repository.obj exists as does dna.lib. I am linking aop_interface.lib into my application (or at least trying to)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          I cannot see anymore your original post, what was the error??

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DRoscoe
            wrote on last edited by
            #5

            @DRoscoe said:

            I am getting what looks like a typical "unresolved external" error that defies my attempts at resolving. Unlike several others I have already fixed, this one has a bit of information that is not normal:

            aop_interface.lib(FmcIntentWaypoint.obj):-1: error: LNK2001: unresolved external symbol "public: static class dna::Repository * __cdecl ACE_Unmanaged_Singleton<class dna::Repository,class ACE_Recursive_Thread_Mutex>::instance(void)" (?instance@?$ACE_Unmanaged_Singleton@VRepository@dna@@VACE_Recursive_Thread_Mutex@@@@SAPAVRepository@dna@@XZ)

            The above looks normal, but after this error, there is an additional line:

            File not found: aop_interface.lib(FmcIntentWaypoint.obj)

            I believe this is a clue as to why I can't resolve this problem. I looked in the DEBUG folder for the project and I do see the file in question.

            Any idea what's going on?

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mcosta
              wrote on last edited by
              #6

              Where aop_interface.lib is defined and built? and where is linked?

              Once your problem is solved don't forget to:

              • Mark the thread as SOLVED using the Topic Tool menu
              • Vote up the answer(s) that helped you to solve the issue

              You can embed images using (http://imgur.com/) or (http://postimage.org/)

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DRoscoe
                wrote on last edited by
                #7

                The main SUBDIRS project builds the library:

                CONFIG += c++11 ordered
                TEMPLATE = subdirs

                SUBDIRS +=
                aop_logger
                aop_xml
                aop_serial
                aop_util
                aop_measure
                MathUtilities
                DataCollection
                DebugLogger
                MoreMath
                AvionicsBus
                AircraftDataModel
                WindModel
                TableLookups
                configuration
                dna
                aop_data
                aop_comm
                tap_data
                AtosUtils
                tap_messaging
                BufferedSharedMemory
                RouteContainer
                aop_interface
                tap_new_display_app

                It is linked in the main application subproject:

                include(../top_srcdir.pri) # defines top-level source trees
                include(../ace_lib.pri) # defines ACE library
                include(../tap_data.pri) # defines tap_data library
                include(../tap_messaging.pri) # defines tap_messaging library

                QT += qml quick widgets
                INCLUDEPATH = $$aop_util_includes
                $$aop_logger_includes
                $$tap_data_includes
                $$aop_serial_includes
                $$tap_messaging_includes
                $$aop_data_includes
                $$aop_measure_includes
                $$aop_interface_includes
                $$aop_xml_includes
                include(../ace_path.pri)
                include(../dna.pri)
                include(../aop_logger.pri)
                include(../aop_interface.pri)
                include(../aop_util.pri)
                include(../aop_xml.pri)
                include(../aop_serial.pri)
                include(../aop_measure.pri)
                include(../AvionicsBus.pri)
                SOURCES += $$files(.cpp)
                HEADERS += $$files(
                .hpp)

                RESOURCES += qml.qrc

                QML_IMPORT_PATH =

                include(deployment.pri)

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mcosta
                  wrote on last edited by mcosta
                  #8

                  Is it possible to show the LIBS contents while building??

                  Could be also a dependency problem, are your libraries static or dynamic?

                  Once your problem is solved don't forget to:

                  • Mark the thread as SOLVED using the Topic Tool menu
                  • Vote up the answer(s) that helped you to solve the issue

                  You can embed images using (http://imgur.com/) or (http://postimage.org/)

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DRoscoe
                    wrote on last edited by
                    #9

                    I will instrument the files to get the output you request. The libraries are all static.

                    M 1 Reply Last reply
                    0
                    • D DRoscoe

                      I will instrument the files to get the output you request. The libraries are all static.

                      M Offline
                      M Offline
                      mcosta
                      wrote on last edited by
                      #10

                      @DRoscoe said:

                      The libraries are all static.

                      IIRC Static libraries need to be linked in the right order. This means that if the library libA uses objects of library libB you have to link in sequence -lB -lA.

                      Once your problem is solved don't forget to:

                      • Mark the thread as SOLVED using the Topic Tool menu
                      • Vote up the answer(s) that helped you to solve the issue

                      You can embed images using (http://imgur.com/) or (http://postimage.org/)

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        DRoscoe
                        wrote on last edited by
                        #11

                        What is the best way to ensure proper linking order? Should it be handled on a per library basis? For example, MY_APP relies on library MY_LIB. MY_LIB relies on LIBa, LIBb and LIBc in that order. Should I enforce linking at MY_LIB so that MY_APP only needs to link MY_LIB, or should MY_APP link LIBa, LIBb, LIBc and then MY_LIB?

                        M 1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          DRoscoe
                          wrote on last edited by
                          #12

                          OK, I went through each project and cleaned up the dependencies and now the project builds and runs. It crashes, but that's a problem with my functional code.

                          I would still like to know what the best way to handle library dependencies is WRT static libraries because a lack of understanding will just lead to repeat problems later, if I change the project around. I don't have this problem when I build my project outside of Qt Creator/qmake. On the Windows side, I use cmake to create the project files and I am intimately familiar with how to work with it. I am new to Qt Creator/qmake, so I am making a lot of mistakes. I need to learn this, though, since I also need to build for MacOS and iOS and I am using qmake to generate the xCode project files.

                          Thank you for your help!

                          1 Reply Last reply
                          0
                          • D DRoscoe

                            What is the best way to ensure proper linking order? Should it be handled on a per library basis? For example, MY_APP relies on library MY_LIB. MY_LIB relies on LIBa, LIBb and LIBc in that order. Should I enforce linking at MY_LIB so that MY_APP only needs to link MY_LIB, or should MY_APP link LIBa, LIBb, LIBc and then MY_LIB?

                            M Offline
                            M Offline
                            mcosta
                            wrote on last edited by
                            #13

                            @DRoscoe said:

                            Should I enforce linking at MY_LIB so that MY_APP only needs to link MY_LIB

                            Honestly I don't know if all platforms/compilers support it.

                            Once your problem is solved don't forget to:

                            • Mark the thread as SOLVED using the Topic Tool menu
                            • Vote up the answer(s) that helped you to solve the issue

                            You can embed images using (http://imgur.com/) or (http://postimage.org/)

                            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