Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-132074

Linker errors with multiple definitions for translations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2: Important P2: Important
    • None
    • 6.8.0
    • Build System: CMake
    • None
    • CMake Linux

      When I try to add translation files for my project I get link errors for multiple definitions of translation related files:

      /usr/bin/ld: DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/4COPAEF2SH/qrc_DeepSkyStacker_translations.cpp.o (symbol from plugin): in function `qInitResources_DeepSkyStacker_translations()': (.text+0x0): multiple definition of `qInitResources_DeepSkyStacker_translations()'; DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/__/.qt/rcc/qrc_DeepSkyStacker_translations.cpp.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/4COPAEF2SH/qrc_DeepSkyStacker_translations.cpp.o (symbol from plugin): in function `qInitResources_DeepSkyStacker_translations()': (.text+0x0): multiple definition of `qCleanupResources_DeepSkyStacker_translations()'; DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/__/.qt/rcc/qrc_DeepSkyStacker_translations.cpp.o (symbol from plugin):(.text+0x0): first defined here

      My CMakeLists.txt file contains:

      qt_add_executable(DeepSkyStacker ${ALL_FILES})
      qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES ca cs de es fr it ja_JP nl pt_BR ro ru tr zh_CN zh_TW)
      qt_add_translations(${PROJECT_NAME} PLURALS_TS_FILE en TS_FILE_DIR i18n) 

      When I run the build step I see

      [119/168] Automatic MOC and UIC for target DeepSkyStacker
      [120/168] Automatic RCC for resources.qrc
      [121/168] Automatic RCC for ../.qt/rcc/DeepSkyStacker_translations.qrc
      [122/168] Building CXX object DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/__/.qt/rcc/qrc_DeepSkyStacker_translations.cpp.o
      [123/168] Building CXX object DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/cmake_pch.hxx.gch
         :
         :
      [166/168] Building CXX object DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/4COPAEF2SH/qrc_DeepSkyStacker_translations.cpp.o
      [167/168] Building CXX object DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/EWIEGA46WW/qrc_resources.cpp.o
      

      Which tells me that you are auto generating TWO qrc files for the translation files which causes the link error.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qtbuildsystem Qt Build System Team
            perdrix David Partridge
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes