Unsolved Multiple definitions: qInitResources_translations()
-
My CMake project produces
qrc_translations.cpp
files for 3 different QML libraries I use. Each one of these reproduces the same symbol: qInitResources_translations. This is seemingly becauseQT_NAMESPACE
is empty. When it is defined to something, the macro here will make that symbol unique:int QT_RCC_MANGLE_NAMESPACE(qInitResources_translations)();
So this is probably a dumb question, but where is
QT_NAMESPACE
supposed to be defined?FWIW, I'm porting from Qt5.6 to 6.x. I had no issues with the previous
qt5_add_translation()
so I'm probably misusing the newqt_add_translations()
?Here is the meat of the CMakeLists.txt file that is similar across the three QML libraries. The Qt6_FOUND section is what I seem to be having issues with.
if (Qt6_FOUND) qt_add_library(BCControls STATIC) file(GLOB TS_FILES translations/*.ts) qt_add_translations(BCControls TS_FILES ${TS_FILES}) qt_add_qml_module(BCControls URI BCControls VERSION 1.0 QML_FILES ${QML_FILES} RESOURCES ${RESOURCE_FILES} ) else() create_install_plugin_translations(translations BCControls/translations QM_FILES ) add_library(BCControls STATIC ${QM_FILES}) qtquick_compiler_add_resources(RESOURCES bccontrols.qrc) target_sources(BCControls PRIVATE ${RESOURCES} ${QML_FILES} bccontrols.qrc ) foreach(F ${QM_FILES}) get_filename_component(COPY_FILE ${F} NAME) add_custom_command(TARGET BCControls POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${F} ${CMAKE_INSTALL_PREFIX}/BCControls/translations/${COPY_FILE}) endforeach() endif()
-
This post is deleted!