Did anyone try to include ROOT in a Qt6 application?
For me upgrading from Qt5 to Qt6 breaks compilation. Just including TString.h in main.cpp and adding TString a = “a” produces 4000k+ errors.
In Qt5 everything works, and I did try c++11/c++14/c++17 flags.
Any (even very wild) suggestions are very welcomed!
Hi @Andr,
I am not aware of ROOT supporting Qt 6 (maybe @bellenot knows more details). I am curious to see those errors anyway. Any chance of attaching the compiler output here?
Cheers,
J.
Sorry, I have no idea (and FYI, ROOT & Qt is not officially supported)
Mostly they are conflicting declarations
Example (no other code except TString a = “a”):
/opt/root/include/ROOT/RStringView.hxx:32: error: conflicting declaration of template ‘template<class _CharT, class _Traits> using basic_string_view = std::experimental::__ROOT::basic_string_view<_CharT, _Traits>’
/opt/root/include/ROOT/RStringView.hxx:32:10: error: conflicting declaration of template ‘template<class _CharT, class _Traits> using basic_string_view = std::experimental::__ROOT::basic_string_view<_CharT, _Traits>’
32 | using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>;
| ^~~~~~~~~~~~~~~~~
I have application, where Qt6 and ROOT used together.
Most probably, you have mismatch in C++ standards between ROOT and Qt6.
Please check your qt project file.
Thank you Sergej,
Can you be more specific please? What should I check? The compile flag (c++ version) has no effect.
Andrey
If you are using qt project file, it should have line like:
CONFIG+=c++11
It should match with ROOT C++ standard.
That’s what I meant - I have already tested with c++11, c++14 and c++17, the result is the same.
That output have your root-config --cflags
And can you check that is CXXFLAGS
in generated by qt makefile
Actually, I compile my project with qt6 using cmake.
And normally I using c++17 when building ROOT
Did not help too:
I have put all the flags from the root-config --cflags to .pro file using QMAKE_CXXFLAGS
The ROOT binaries were downloaded directly from the root download page for Ubuntu20.04
Most (if not all) of the errors are “conflicting declarations” in the ROOT templates, I still have no idea what can it be, never had such problems with Qt5.
Can you check inside generated makefile? Probably Qt adds own settings.
Your symptoms indicating that you try to compile ROOT headers with different C++ standard.
Thank you Sergej!
I have tested that the syntax of c++11 does not stop the code form compilation (when Root is not imported)