Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Discrepancies in link order between Windows/Linux/Mac?



  • I'm having difficulties building a Qt solution on Mac.
    Basically I have a static library used in the main program.

    It builds fine on Linux.

    On my Mac, I have the following error:

    Undefined symbols for architecture x86_64:
      "initWf(int, int, int, int)", referenced from:
          CardioS::init() in libcardios.a(cardios.o)
    ld: symbol(s) not found for architecture x86_64
    

    The code is located in the static library.

    Here is the failing command line:

    /Library/Developer/CommandLineTools/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names  -arch x86_64 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.12 -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/Users/omatrot/Qt/5.13.1/clang_64/lib -o ../CardioSensys.app/Contents/MacOS/CardioSensys obj/main.o obj/qcustomplot.o obj/inputsubjectdata.o obj/RadarDashboard.o obj/mainwindow.o obj/CustomButton.o obj/CustomPlot.o obj/RCDialog.o obj/O2Dialog.o obj/TADialog.o obj/VCDialog.o obj/IRDialog.o obj/EADialog.o obj/RespDialog.o obj/CaptureDevice.o obj/qrc_ressources.o obj/moc_CustomButton.o obj/moc_inputsubjectdata.o obj/moc_mainwindow.o obj/moc_RadarDashboard.o obj/moc_stoppingthread.o obj/moc_qcustomplot.o   -F/Users/omatrot/Qt/5.13.1/clang_64/lib -L.. -lcardios -framework QtPrintSupport -framework QtSvg -framework QtWidgets -framework QtGui -framework QtSerialPort -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
    

    I can see the reference to my library though:

    -lcardios
    

    Could it be a link order problem? If so how could I solve it without breaking the build on Linux?



  • @Olivier-MATROT

    Is the class CardioS and initWf in the same library?
    I would assume that CardioS is part of libcardios as the link return indicates. Therefore, the question is if initWf is also part of that library. If yes, you need to check if there is a macro exclusion or similar is happening.
    If no, the object or library holding initWf is missing.



  • Yes they are indeed.


Log in to reply