Qt5 Mac OS 10.7 "ld: 2 duplicate symbols for architecture x86_64"



  • Hello everybody,

    I've an application witch is compiled correctly with Qt5 under Windows using Qt Creator. But, the same source code compiled on Mac OS 10.7 using Qt Creator generate the following error

    duplicate symbol __Z23qInitResources_autonomev in: qrc_autonome.o duplicate symbol __Z26qCleanupResources_autonomev in: qrc_autonome.o 
    ld: 2 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Debug/Autonome.app/Contents/MacOS/Autonome] Error 1 
    09:00:44: Le processus "/usr/bin/make" s'est terminé avec le code 2. Erreur lors de la compilation/déploiement du projet autonome (kit : Desktop Qt 5.5.1 clang 64bit) When executing step "Make"
    

    I've tried for 2 days to search and resolve this common problem but It persists.
    Kwoning that when I comment the REOURCES entry in the pri file, application is compiled correctly.

    Can anyone tell what's wrong and how to fix this really blocant problem.

    Best regards.



  • Hi @mourad_bilog

    In qt creator there is a compile output tab is it possible to share with us the build output of this tab , when trying to build your project?

    alt text



  • Thanks for replying,

    Below the compile output
    0_1487865099663_CompilationOutput.png



  • @mourad_bilog

    I am not seeing your copile output?

    Are sure you correctly made a copy, paste?



  • I've made a sreen-captured, did you seen the image ?

    Anyway, below the build ouput text containg the error

    Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
    Target: x86_64-apple-darwin11.4.2
    Thread model: posix
     "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -headerpad_max_install_names -macosx_version_min 10.7.0 -o Debug/Autonome.app/Contents/MacOS/Autonome -lcrt1.10.6.o -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -rpath /Users/admin/Qt/5.5/clang_64/lib AllergieQueryModel.o checkboxdelegate.o excipientmodel.o frmalerte.o frmallergie.o frmapropos.o frmfiltre.o frmhelp.o frminter.o frmlisteordo.o frmmedic.o frmmono.o frmordo.o frmparam.o frmPatient.o frmposo.o frmposolibre.o frmpraticien.o frmrecherche.o frmrechpat.o frmrechpatient.o frmremp.o frmusers.o frmwindow.o intermodel.o journaldb.o Licence.o licencewizard.o main.o md5.o medicmodel.o mysortfilterproxymodel.o OrdoApi.o ordodoc.o Outil.o paramordo.o phasedelegate.o printpreview.o qrc_autonome.o qsqlquerymedic.o qsqlreadtablemodel.o RechPre.o remptablemodel.o struct_theria.o termequerymodel.o textedit.o theriabd.o qrc_autonome.o moc_AllergieQueryModel.o moc_checkboxdelegate.o moc_excipientmodel.o moc_frmalerte.o moc_frmallergie.o moc_frmapropos.o moc_frmfiltre.o moc_frmhelp.o moc_frminter.o moc_frmlisteordo.o moc_frmmedic.o moc_frmmono.o moc_frmordo.o moc_frmparam.o moc_frmPatient.o moc_frmposo.o moc_frmposolibre.o moc_frmpraticien.o moc_frmrecherche.o moc_frmrechpat.o moc_frmrechpatient.o moc_frmremp.o moc_frmusers.o moc_frmwindow.o moc_intermodel.o moc_journaldb.o moc_licencewizard.o moc_medicmodel.o moc_mysortfilterproxymodel.o moc_ordodoc.o moc_paramordo.o moc_phasedelegate.o moc_printpreview.o moc_qsqlquerymedic.o moc_qsqlreadtablemodel.o moc_RechPre.o moc_remptablemodel.o moc_termequerymodel.o moc_textedit.o -framework QtPrintSupport -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework QtNetwork -framework QtSql -framework QtXml -framework OpenGL -framework AGL -lstdc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/4.2/lib/darwin/libclang_rt.osx.a -F/Users/admin/Qt/5.5/clang_64/lib
    duplicate symbol __Z23qInitResources_autonomev in:
        qrc_autonome.o
    duplicate symbol __Z26qCleanupResources_autonomev in:
        qrc_autonome.o
    ld: 2 duplicate symbols for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [Debug/Autonome.app/Contents/MacOS/Autonome] Error 1
    12:04:00: Le processus "/usr/bin/make" s'est terminé avec le code 2.
    Erreur lors de la compilation/déploiement du projet autonome (kit : Desktop Qt 5.5.1 clang 64bit)
    When executing step "Make"
    12:04:00: Temps écoulé : 03:34.
    
    

  • Lifetime Qt Champion

    Hi,

    Do you have several qrc files ?



  • Hi SGaist,

    There's only one qrc file in the application.


  • Lifetime Qt Champion

    Can you show your .pro file ?



  • I've solved the problem by generating a new qrc_app.cpp file.

    Thanks for your responses.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.