ROS2 not added in QT6
-
@Pl45m4 This github rebo
The problem is that it works fine when I compile it with QT5.15Easily communicates with ROS2
When I compile the same code with QT6, I get the following errors:
There are 240 errors similar to these errors.
Note:
ROS2 (Robot Operating System 2) is a flexible framework for writing robot software. It is the next-generation version of the original ROS (Robot Operating System) and is designed to address the limitations of ROS 1, offering more robust, scalable, and real-time capabilities. ROS 2 enables the development of robot applications that can run on various hardware platforms, from small embedded devices to large, complex robots. -
@serkan_tr What compiler is used when you're building for Qt6? And what compiler was used for Qt5?
-
Please show the very first error message (as text, not picture)
-
-permissive- -utf-8 /showIncludes /FoCMakeFiles\qt_ros2_Joystick.dir\main.cpp.obj /FdCMakeFiles\qt_ros2_Joystick.dir\ /FS -c C:\ems\QT-ROS2-Joystick\main.cpp C:\Qt\6.5.3\msvc2019_64\include\QtCore\qcoreapplication.h(36): error C2124: divide or mod by zero C:\Qt\6.5.3\msvc2019_64\include\QtCore\qcoreapplication.h(114): error C2124: divide or mod by zero C:\Qt\6.5.3\msvc2019_64\include\QtCore\qcoreapplication.h(115): error C2039: 'PermissionStatus': is not a member of 'Qt' C:\opt\ros\foxy\x64\include\QtCore/qtextstream.h(236): note: see declaration of 'Qt' C:\Qt\6.5.3\msvc2019_64\include\QtCore\qcoreapplication.h(115): error C3646: 'checkPermission': unknown override specifier C:\Qt\6.5.3\msvc2019_64\include\QtCore\qcoreapplication.h(115): error C2059: syntax error: '(' C:\Qt\6.5.3\msvc2019_64\include\QtCore\qcoreapplication.h(115): error C2238: unexpected token(s) preceding ';' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsnumbercoercion.h(33): error C2065: 'QT_WARNING_DISABLE_FLOAT_COMPARE': undeclared identifier C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsnumbercoercion.h(34): error C2143: syntax error: missing ';' before 'return' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(131): error C2144: syntax error: 'QJSPrimitiveValue' should be preceded by ';' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(131): error C2178: 'QJSPrimitiveValue::Q_IMPLICIT' cannot be declared with 'constexpr' specifier C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(132): error C2144: syntax error: 'QJSPrimitiveValue' should be preceded by ';' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(132): error C2178: 'QJSPrimitiveValue::Q_IMPLICIT' cannot be declared with 'constexpr' specifier C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(133): error C2144: syntax error: 'QJSPrimitiveValue' should be preceded by ';' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(133): error C2178: 'QJSPrimitiveValue::Q_IMPLICIT' cannot be declared with 'constexpr' specifier C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(134): error C2144: syntax error: 'QJSPrimitiveValue' should be preceded by ';' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(134): error C2178: 'QJSPrimitiveValue::Q_IMPLICIT' cannot be declared with 'constexpr' specifier C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(135): error C2144: syntax error: 'QJSPrimitiveValue' should be preceded by ';' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(135): error C2178: 'QJSPrimitiveValue::Q_IMPLICIT' cannot be declared with 'constexpr' specifier C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(136): error C2144: syntax error: 'QJSPrimitiveValue' should be preceded by ';' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(136): error C2178: 'QJSPrimitiveValue::Q_IMPLICIT' cannot be declared with 'constexpr' specifier C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(137): error C3646: 'QJSPrimitiveValue': unknown override specifier C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(137): error C2059: syntax error: '(' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(137): error C2334: unexpected token(s) preceding ':'; skipping apparent function body C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(792): error C2059: syntax error: 'namespace' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsprimitivevalue.h(792): error C2334: unexpected token(s) preceding '{'; skipping apparent function body C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsmanagedvalue.h(13): error C2059: syntax error: 'namespace' C:\Qt\6.5.3\msvc2019_64\include\QtQml/qjsmanagedvalue.h(13): error C2334: unexpected token(s) preceding '{'; skipping apparent function body C:\Qt\6.5.3\msvc2019_64\include\QtQml\qjsengine.h(348): error C2804: binary 'operator |' has too many parameters C:\Qt\6.5.3\msvc2019_64\include\QtQml\qjsengine.h(348): error C2333: 'QJSPrimitiveValue::operator |': error in function declaration; skipping function body C:\Qt\6.5.3\msvc2019_64\include\QtQml\qjsengine.h(351): error C2535: 'T QJSPrimitiveValue::qjsvalue_cast(const QJSValue &)': member function already defined or declared C:\Qt\6.5.3\msvc2019_64\include\QtQml\qjsengine.h(21): note: see declaration of 'QJSPrimitiveValue::qjsvalue_cast' C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): error C2912: explicit specialization 'const char *QJSPrimitiveValue::qobject_interface_iid(void)' is not a specialization of a function template C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): error C2912: explicit specialization 'QJSPrimitiveValue::QQmlParserStatus *QJSPrimitiveValue::qobject_cast(QObject *)' is not a specialization of a function template C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): error C2988: unrecognizable template declaration/definition C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): error C2143: syntax error: missing ';' before '<' C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): error C2365: 'QJSPrimitiveValue::qobject_cast': redefinition; previous definition was 'member function' C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): note: see declaration of 'QJSPrimitiveValue::qobject_cast' C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): error C2238: unexpected token(s) preceding ';' C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): error C2059: syntax error: '<' C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): error C2334: unexpected token(s) preceding '{'; skipping apparent function body C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(69): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(69): note: the template instantiation context (the oldest one first) is C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(56): note: while compiling class template 'QJSPrimitiveValue::QQmlListProperty' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(75): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(80): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(92): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(104): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(119): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(204): error C2760: syntax error: 'identifier' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(204): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(204): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(205): error C2760: syntax error: 'identifier' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(206): error C2760: syntax error: 'identifier' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(207): error C2760: syntax error: '~' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(209): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(211): error C2760: syntax error: 'identifier' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(211): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(212): error C2760: syntax error: 'const' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(212): error C2955: 'QJSPrimitiveValue::QMetaObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(51): note: see declaration of 'QJSPrimitiveValue::QMetaObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(214): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(215): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(216): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(217): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(218): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(219): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(221): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(222): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(224): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(224): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(224): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(225): error C2760: syntax error: 'identifier' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(225): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(226): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(227): error C2760: syntax error: 'int' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(228): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(228): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(228): error C2955: 'QJSPrimitiveValue::QObject': use of class template requires template argument list C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(50): note: see declaration of 'QJSPrimitiveValue::QObject' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(229): error C2760: syntax error: 'bool' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(231): error C2760: syntax error: 'private' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmllist.h(238): error C3412: 'QMetaTypeId<QJSPrimitiveValue::QQmlListReference>': cannot specialize template in current scope C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(54): error C2760: syntax error: 'virtual' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(55): error C2760: syntax error: 'virtual' was unexpected here; expected ';' C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(56): error C2059: syntax error: '}' C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(60): error C2988: unrecognizable template declaration/definition C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(60): error C2143: syntax error: missing ';' before '<' C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(60): error C2365: 'QJSPrimitiveValue::qobject_interface_iid': redefinition; previous definition was 'member function' C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): note: see declaration of 'QJSPrimitiveValue::qobject_interface_iid' C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(60): error C2238: unexpected token(s) preceding ';' C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(60): error C2059: syntax error: '<' C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(60): error C2334: unexpected token(s) preceding '{'; skipping apparent function body C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(60): error C2365: 'QJSPrimitiveValue::qobject_cast': redefinition; previous definition was 'member function' C:\opt\ros\foxy\x64\include\QtQml/qqmlparserstatus.h(67): note: see declaration of 'QJSPrimitiveValue::qobject_cast' C:\opt\ros\foxy\x64\include\QtQml/qqmlpropertyvaluesource.h(60): fatal error C1003: error count exceeds 100; stopping compilation ninja: build stopped: subcommand failed. 13:51:34: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited with code 1. Error while building/deploying project qt_ros2_Joystick (kit: Desktop Qt 6.5.3 MSVC2019 64bit) When executing step "Build"
-
from what I can see ROS2 should be an externally linked library, so nothing should have changed by simply switching Qt5 with Qt6, if you didn't change anything else in your project file.Can you actually compile a simple Qt6 program and if that works link it against ros2 ?actually strike that:
https://docs.ros.org/en/foxy/Installation/Alternatives/Windows-Development-Setup.html
It's based on Qt5 so you can't simply switch to Qt6 yourself and expect it to work. Qt6 broke compatibility with Qt5.
You would probably have to change the ros2 sourcecode where needed and if possible. -
@serkan_tr like I said, you're trying to compile a program/library that is written for Qt5 with Qt6 libraries that won't work.
Either fix/rewrite the ros2 code or compile it as a dll with Qt5 and and use it that way
-