Strange Linking Error
-
@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?
-
The main SUBDIRS project builds the library:
CONFIG += c++11 ordered
TEMPLATE = subdirsSUBDIRS +=
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_appIt 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 libraryQT += 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)
-
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?
-
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!
-
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?