Fedora only - moc file generates multiple definitions for `QtPrivate::IsFloatType_v<_Float16>'
-
When I try to build a rather simple projet that builds on Windows, on Fedora, I get
usr/bin/ld: CMakeFiles/GraphicsViewTest2.dir/main.cpp.o:(.rodata+0x10): multiple definition ofQtPrivate::IsFloatType_v<_Float16>'; CMakeFiles/GraphicsViewTest2.dir/GraphicsViewTest2_autogen/mocs_compilation.cpp.o:(.rodata+0x10): first defined here /usr/bin/ld: CMakeFiles/GraphicsViewTest2.dir/graphicsviewtest2mainwindow.cpp.o:(.rodata+0x10): multiple definition of
QtPrivate::IsFloatType_v<_Float16>'; CMakeFiles/GraphicsViewTest2.dir/GraphicsViewTest2_autogen/mocs_compilation.cpp.o:(.rodata+0x10): first defined here
These seem to be the same place.
The SAME project builds on Windows, but not Fedora
And I have deleted the build directory -
How did you create your cmake environment? and can you try to build your project using qmake as a test?
These kinds of problems are often related to build environment that hasn't been updated after adding files, or a partial build where artifacts are not completely deleted before a rebuild.
The linker error is telling you that more than one object file is trying to include the same symbol. This is often because of an #include guard not being honored, or an older .o file (an artifact)
-
How did you create your cmake environment? and can you try to build your project using qmake as a test?
These kinds of problems are often related to build environment that hasn't been updated after adding files, or a partial build where artifacts are not completely deleted before a rebuild.
The linker error is telling you that more than one object file is trying to include the same symbol. This is often because of an #include guard not being honored, or an older .o file (an artifact)
@Kent-Dorfman the error gives the SAME file - the moc file. What is strange is clean builds on Windows works (my copy using Beyond Compare leaves out the .user and build files) but not clean builds on Fedora.
The CMake environment was done using QtCreator. And as I said, I deleted the build directory on Fedora and the problem still occurs. Still trying to get my Ubuntu environment to work (CMake can't fine Qt; I've fixed that before on older systems, but did not have time tonight)
So far, it seems to be something due to Fedora or Linux. I did reinstall Qt from qt.io instead of using what fedora wanted to install. Same problem. This makes me wonder if it is due to differences between MingW (on Windows) and g++ on Fedora.
If I try CMake directly on Fedora, it can't find Qt. Once I fix that on Ubuntu, I will see if I can fix it on Fedora.
Thank you for your answer, and I will get more information