Closed willzoe closed 4 years ago
我使用的系统是Ubuntu16.04,ROS版本是Kinetic。
当我把代码克隆到src文件夹之后,在工作空间执行编译命令
catkin_make
,显示如下编译信息和错误,我应该如何正确编译呢?Base path: /home/willzoe1604/myrobot_qt Source space: /home/willzoe1604/myrobot_qt/src Build space: /home/willzoe1604/myrobot_qt/build Devel space: /home/willzoe1604/myrobot_qt/devel Install space: /home/willzoe1604/myrobot_qt/install #### #### Running command: "cmake /home/willzoe1604/myrobot_qt/src -DCATKIN_DEVEL_PREFIX=/home/willzoe1604/myrobot_qt/devel -DCMAKE_INSTALL_PREFIX=/home/willzoe1604/myrobot_qt/install -G Unix Makefiles" in "/home/willzoe1604/myrobot_qt/build" #### -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc - works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ - works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Using CATKIN_DEVEL_PREFIX: /home/willzoe1604/myrobot_qt/devel -- Using CMAKE_PREFIX_PATH: /home/willzoe1604/myrobot_qt/devel;/home/willzoe1604/turtlebot/devel;/home/willzoe1604/kobuki/devel;/home/willzoe1604/rocon/devel;/opt/ros/kinetic -- This workspace overlays: /home/willzoe1604/myrobot_qt/devel;/home/willzoe1604/turtlebot/devel;/home/willzoe1604/kobuki/devel;/home/willzoe1604/rocon/devel;/opt/ros/kinetic -- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.12", minimum required is "2") -- Using PYTHON_EXECUTABLE: /usr/bin/python2 -- Using Debian Python package layout -- Using empy: /usr/bin/empy -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/willzoe1604/myrobot_qt/build/test_results -- Found gtest sources under '/usr/src/gmock': gtests will be built -- Found gmock sources under '/usr/src/gmock': gmock will be built -- Found PythonInterp: /usr/bin/python2 (found version "2.7.12") -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Using Python nosetests: /usr/bin/nosetests-2.7 -- catkin 0.7.20 -- BUILD_SHARED_LIBS is on -- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy -- Configuring done -- Generating done -- Build files have been written to: /home/willzoe1604/myrobot_qt/build #### #### Running command: "make -j8 -l8" in "/home/willzoe1604/myrobot_qt/build" #### [ 3%] Generating include/cyrobot_monitor/moc_settings.cpp [ 7%] Generating qrc_images.cpp [ 11%] Generating ui_addtopics.h [ 14%] Generating qrc_media.cpp [ 18%] Generating ui_main_window.h [ 22%] Generating ui_settings.h [ 25%] Generating include/cyrobot_monitor/moc_CCtrlDashBoard.cpp [ 29%] Generating include/cyrobot_monitor/moc_addtopics.cpp [ 33%] Generating include/cyrobot_monitor/moc_main_window.cpp [ 37%] Generating include/cyrobot_monitor/moc_qnode.cpp [ 40%] Generating include/cyrobot_monitor/moc_qrviz.cpp Scanning dependencies of target cyrobot_monitor [ 44%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/CCtrlDashBoard.cpp.o [ 48%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/addtopics.cpp.o [ 51%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/main.cpp.o [ 55%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/main_window.cpp.o [ 59%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/qrviz.cpp.o [ 62%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/qnode.cpp.o [ 66%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/settings.cpp.o [ 70%] Building CXX object CMakeFiles/cyrobot_monitor.dir/qrc_images.cpp.o In file included from /home/willzoe1604/myrobot_qt/src/src/CCtrlDashBoard.cpp:1:0: /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/CCtrlDashBoard.h:14:47: error: ‘nullptr’ was not declared in this scope explicit CCtrlDashBoard(QWidget *parent = nullptr, StyleType type=ST ^ CMakeFiles/cyrobot_monitor.dir/build.make:226: recipe for target 'CMakeFiles/cyrobot_monitor.dir/src/CCtrlDashBoard.cpp.o' failed make[2]: *** [CMakeFiles/cyrobot_monitor.dir/src/CCtrlDashBoard.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... /home/willzoe1604/myrobot_qt/src/src/qnode.cpp: In member function ‘void cyrobot_monitor::QNode::move_base(char, float, float)’: /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:154:38: error: ‘>>’ should be ‘> >’ within a nested template argument list std::map<char, std::vector<float>> moveBindings ^ /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:155:6: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 { ^ /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:176:6: error: in C++98 ‘moveBindings’ must be initialized by constructor, not by ‘{...}’ }; ^ /home/willzoe1604/myrobot_qt/src/src/qnode.cpp: In substitution of ‘template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) [with _InputIterator = <missing>]’: /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:176:6: required from here /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:176:6: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:176:6: error: no matching function for call to ‘std::map<char, std::vector<float> >::map(<brace-enclosed initializer list>)’ In file included from /usr/include/c++/5/map:61:0, from /opt/ros/kinetic/include/ros/console.h:42, from /opt/ros/kinetic/include/ros/ros.h:40, from /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:13: /usr/include/c++/5/bits/stl_map.h:273:9: note: candidate: template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) map(_InputIterator __first, _InputIterator __last, ^ /usr/include/c++/5/bits/stl_map.h:273:9: note: template argument deduction/substitution failed: /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:176:6: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 }; ^ /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:176:6: note: cannot convert ‘{'j', {0, 0, 0, 1}}’ (type ‘<brace-enclosed initializer list>’) to type ‘const std::less<char>&’ In file included from /usr/include/c++/5/map:61:0, from /opt/ros/kinetic/include/ros/console.h:42, from /opt/ros/kinetic/include/ros/ros.h:40, from /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:13: /usr/include/c++/5/bits/stl_map.h:256:9: note: candidate: template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) map(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/5/bits/stl_map.h:256:9: note: template argument deduction/substitution failed: /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:176:6: note: candidate expects 2 arguments, 20 provided }; ^ In file included from /usr/include/c++/5/map:61:0, from /opt/ros/kinetic/include/ros/console.h:42, from /opt/ros/kinetic/include/ros/ros.h:40, from /home/willzoe1604/myrobot_qt/src/src/qnode.cpp:13: /usr/include/c++/5/bits/stl_map.h:185:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = char; _Tp = std::vector<float>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::vector<float> > >] map(const map& __x) ^ /usr/include/c++/5/bits/stl_map.h:185:7: note: candidate expects 1 argument, 20 provided /usr/include/c++/5/bits/stl_map.h:174:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::map(const _Compare&, const allocator_type&) [with _Key = char; _Tp = std::vector<float>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::vector<float> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const char, std::vector<float> > >] map(const _Compare& __comp, ^ /usr/include/c++/5/bits/stl_map.h:174:7: note: candidate expects 2 arguments, 20 provided /usr/include/c++/5/bits/stl_map.h:162:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::map() [with _Key = char; _Tp = std::vector<float>; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, std::vector<float> > >] map() ^ /usr/include/c++/5/bits/stl_map.h:162:7: note: candidate expects 0 arguments, 20 provided In file included from /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/main_window.hpp:16:0, from /home/willzoe1604/myrobot_qt/src/src/main.cpp:14: /home/willzoe1604/myrobot_qt/build/ui_main_window.h: In member function ‘void Ui_MainWindowDesign::setupUi(QMainWindow*)’: /home/willzoe1604/myrobot_qt/build/ui_main_window.h:714:23: error: ‘class QPushButton’ has no member named ‘setTabletTracking’ pushButton_i->setTabletTracking(false); ^ In file included from /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/main_window.hpp:16:0, from /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:15: /home/willzoe1604/myrobot_qt/build/ui_main_window.h: In member function ‘void Ui_MainWindowDesign::setupUi(QMainWindow*)’: /home/willzoe1604/myrobot_qt/build/ui_main_window.h:714:23: error: ‘class QPushButton’ has no member named ‘setTabletTracking’ pushButton_i->setTabletTracking(false); ^ CMakeFiles/cyrobot_monitor.dir/build.make:278: recipe for target 'CMakeFiles/cyrobot_monitor.dir/src/qnode.cpp.o' failed make[2]: *** [CMakeFiles/cyrobot_monitor.dir/src/qnode.cpp.o] Error 1 In file included from /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/main_window.hpp:22:0, from /home/willzoe1604/myrobot_qt/src/src/main.cpp:14: /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/CCtrlDashBoard.h: At global scope: /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/CCtrlDashBoard.h:14:47: error: ‘nullptr’ was not declared in this scope explicit CCtrlDashBoard(QWidget *parent = nullptr, StyleType type=ST_DEFAULT); ^ In file included from /home/willzoe1604/myrobot_qt/src/src/main.cpp:14:0: /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/main_window.hpp:133:48: error: ‘>>’ should be ‘> >’ within a nested template argument list QMap <QTreeWidgetItem*,QMap<QString,QString>> tree_rviz_values; ^ In file included from /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/main_window.hpp:22:0, from /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:15: /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/CCtrlDashBoard.h: At global scope: /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/CCtrlDashBoard.h:14:47: error: ‘nullptr’ was not declared in this scope explicit CCtrlDashBoard(QWidget *parent = nullptr, StyleType type=ST_DEFAULT); ^ In file included from /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:15:0: /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/main_window.hpp:133:48: error: ‘>>’ should be ‘> >’ within a nested template argument list QMap <QTreeWidgetItem*,QMap<QString,QString>> tree_rviz_values; ^ /home/willzoe1604/myrobot_qt/src/src/main_window.cpp: In member function ‘void cyrobot_monitor::MainWindow::quick_cmd_add()’: /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:5: warning: lambda expressions only available with -std=c++11 or -std=gnu++11 }); ^ /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: error: no matching function for call to ‘cyrobot_monitor::MainWindow::connect(QPushButton*&, void (QAbstractButton::*)(bool), cyrobot_monitor::MainWindow::quick_cmd_add()::<lambda()>)’ }); ^ In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qabstractanimation.h:37:0, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtCore:4, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGuiDepends:3, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGui:3, from /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:12: /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:196:36: note: candidate: static QMetaObject::Connection QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType) static QMetaObject::Connection connect(const QObject *sender, const char *signal, ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:196:36: note: candidate expects 5 arguments, 3 provided /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:199:36: note: candidate: static QMetaObject::Connection QObject::connect(const QObject*, const QMetaMethod&, const QObject*, const QMetaMethod&, Qt::ConnectionType) static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal, ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:199:36: note: candidate expects 5 arguments, 3 provided /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:475:32: note: candidate: QMetaObject::Connection QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal, ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:475:32: note: no known conversion for argument 2 from ‘void (QAbstractButton::*)(bool)’ to ‘const char*’ /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:213:43: note: candidate: template<class Func1, class Func2> static QMetaObject::Connection QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::ConnectionType) static inline QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:213:43: note: template argument deduction/substitution failed: /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: note: candidate expects 5 arguments, 3 provided }); ^ In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qabstractanimation.h:37:0, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtCore:4, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGuiDepends:3, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGui:3, from /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:12: /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:245:13: note: candidate: template<class Func1, class Func2> static typename QtPrivate::QEnableIf<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2) connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot) ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:245:13: note: template argument deduction/substitution failed: /home/willzoe1604/myrobot_qt/src/src/main_window.cpp: In substitution of ‘template<class Func1, class Func2> static typename QtPrivate::QEnableIf<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2) [with Func1 = void (QAbstractButton::*)(bool); Func2 = cyrobot_monitor::MainWindow::quick_cmd_add()::<lambda()>]’: /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: required from here /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: error: template argument for ‘template<class Func1, class Func2> static typename QtPrivate::QEnableIf<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)’ uses local type ‘cyrobot_monitor::MainWindow::quick_cmd_add()::<lambda()>’ }); ^ /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: error: trying to instantiate ‘template<class Func1, class Func2> static typename QtPrivate::QEnableIf<((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)’ In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qabstractanimation.h:37:0, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtCore:4, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGuiDepends:3, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGui:3, from /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:12: /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:254:13: note: candidate: template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(((int)(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0) && (! QtPrivate::FunctionPointer<Func2>::IsPointerToMemberFunction)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType) connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot, ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:254:13: note: template argument deduction/substitution failed: /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: note: cannot convert ‘<lambda closure object>cyrobot_monitor::MainWindow::quick_cmd_add()::<lambda()>{((cyrobot_monitor::MainWindow*)this), w, name_val, shell_val}’ (type ‘cyrobot_monitor::MainWindow::quick_cmd_add()::<lambda()>’) to type ‘const QObject*’ }); ^ In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qabstractanimation.h:37:0, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtCore:4, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGuiDepends:3, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGui:3, from /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:12: /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:285:13: note: candidate: template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == (-1)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2) connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot) ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:285:13: note: template argument deduction/substitution failed: /home/willzoe1604/myrobot_qt/src/src/main_window.cpp: In substitution of ‘template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == (-1)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2) [with Func1 = void (QAbstractButton::*)(bool); Func2 = cyrobot_monitor::MainWindow::quick_cmd_add()::<lambda()>]’: /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: required from here /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: error: template argument for ‘template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == (-1)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)’ uses local type ‘cyrobot_monitor::MainWindow::quick_cmd_add()::<lambda()>’ }); ^ /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: error: trying to instantiate ‘template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == (-1)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, Func2)’ In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qabstractanimation.h:37:0, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtCore:4, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGuiDepends:3, from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGui:3, from /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:12: /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:293:13: note: candidate: template<class Func1, class Func2> static typename QtPrivate::QEnableIf<(QtPrivate::FunctionPointer<Func2>::ArgumentCount == (-1)), QMetaObject::Connection>::Type QObject::connect(const typename QtPrivate::FunctionPointer<Func>::Object*, Func1, const QObject*, Func2, Qt::ConnectionType) connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot, ^ /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:293:13: note: template argument deduction/substitution failed: /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:837:6: note: cannot convert ‘<lambda closure object>cyrobot_monitor::MainWindow::quick_cmd_add()::<lambda()>{((cyrobot_monitor::MainWindow*)this), w, name_val, shell_val}’ (type ‘cyrobot_monitor::MainWindow::quick_cmd_add()::<lambda()>’) to type ‘const QObject*’ }); ^ /home/willzoe1604/myrobot_qt/src/src/main_window.cpp: In member function ‘void cyrobot_monitor::MainWindow::ReadSettings()’: /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:1081:14: error: ‘c’ does not name a type for(auto c:ch_key) ^ /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:1086:1: error: expected ‘;’ before ‘}’ token } ^ /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:1086:1: error: expected primary-expression before ‘}’ token /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:1086:1: error: expected ‘;’ before ‘}’ token /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:1086:1: error: expected primary-expression before ‘}’ token /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:1086:1: error: expected ‘)’ before ‘}’ token /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:1086:1: error: expected primary-expression before ‘}’ token CMakeFiles/cyrobot_monitor.dir/build.make:252: recipe for target 'CMakeFiles/cyrobot_monitor.dir/src/main.cpp.o' failed make[2]: *** [CMakeFiles/cyrobot_monitor.dir/src/main.cpp.o] Error 1 CMakeFiles/cyrobot_monitor.dir/build.make:265: recipe for target 'CMakeFiles/cyrobot_monitor.dir/src/main_window.cpp.o' failed make[2]: *** [CMakeFiles/cyrobot_monitor.dir/src/main_window.cpp.o] Error 1 CMakeFiles/Makefile2:766: recipe for target 'CMakeFiles/cyrobot_monitor.dir/all' failed make[1]: *** [CMakeFiles/cyrobot_monitor.dir/all] Error 2 Makefile:157: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j8 -l8" failed
我这边用的是Ubuntu18.04,16.04的话在cmakelists加入一句:set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
16.04的话在cmakelists加入一句:set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
添加后之前的错误得到了解决,但是还有新的错误:
Base path: /home/willzoe1604/myrobot_qt
Source space: /home/willzoe1604/myrobot_qt/src
Build space: /home/willzoe1604/myrobot_qt/build
Devel space: /home/willzoe1604/myrobot_qt/devel
Install space: /home/willzoe1604/myrobot_qt/install
####
#### Running command: "cmake /home/willzoe1604/myrobot_qt/src -DCATKIN_DEVEL_PREFIX=/home/willzoe1604/myrobot_qt/devel -DCMAKE_INSTALL_PREFIX=/home/willzoe1604/myrobot_qt/install -G Unix Makefiles" in "/home/willzoe1604/myrobot_qt/build"
####
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/willzoe1604/myrobot_qt/devel
-- Using CMAKE_PREFIX_PATH: /home/willzoe1604/turtlebot/devel;/home/willzoe1604/kobuki/devel;/home/willzoe1604/rocon/devel;/opt/ros/kinetic
-- This workspace overlays: /home/willzoe1604/turtlebot/devel;/home/willzoe1604/kobuki/devel;/home/willzoe1604/rocon/devel;/opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.12", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/willzoe1604/myrobot_qt/build/test_results
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.12")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.20
-- BUILD_SHARED_LIBS is on
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Configuring done
-- Generating done
-- Build files have been written to: /home/willzoe1604/myrobot_qt/build
####
#### Running command: "make -j8 -l8" in "/home/willzoe1604/myrobot_qt/build"
####
[ 3%] Generating include/cyrobot_monitor/moc_settings.cpp
[ 7%] Generating qrc_images.cpp
[ 11%] Generating ui_addtopics.h
[ 14%] Generating qrc_media.cpp
[ 18%] Generating ui_main_window.h
[ 22%] Generating include/cyrobot_monitor/moc_CCtrlDashBoard.cpp
[ 25%] Generating ui_settings.h
[ 29%] Generating include/cyrobot_monitor/moc_addtopics.cpp
[ 33%] Generating include/cyrobot_monitor/moc_qnode.cpp
[ 37%] Generating include/cyrobot_monitor/moc_main_window.cpp
[ 40%] Generating include/cyrobot_monitor/moc_qrviz.cpp
Scanning dependencies of target cyrobot_monitor
[ 44%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/CCtrlDashBoard.cpp.o
[ 48%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/addtopics.cpp.o
[ 51%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/main.cpp.o
[ 55%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/main_window.cpp.o
[ 59%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/qnode.cpp.o
[ 62%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/qrviz.cpp.o
[ 66%] Building CXX object CMakeFiles/cyrobot_monitor.dir/src/settings.cpp.o
[ 70%] Building CXX object CMakeFiles/cyrobot_monitor.dir/qrc_images.cpp.o
[ 74%] Building CXX object CMakeFiles/cyrobot_monitor.dir/qrc_media.cpp.o
[ 77%] Building CXX object CMakeFiles/cyrobot_monitor.dir/include/cyrobot_monitor/moc_CCtrlDashBoard.cpp.o
[ 81%] Building CXX object CMakeFiles/cyrobot_monitor.dir/include/cyrobot_monitor/moc_addtopics.cpp.o
[ 85%] Building CXX object CMakeFiles/cyrobot_monitor.dir/include/cyrobot_monitor/moc_main_window.cpp.o
[ 88%] Building CXX object CMakeFiles/cyrobot_monitor.dir/include/cyrobot_monitor/moc_qnode.cpp.o
[ 92%] Building CXX object CMakeFiles/cyrobot_monitor.dir/include/cyrobot_monitor/moc_qrviz.cpp.o
[ 96%] Building CXX object CMakeFiles/cyrobot_monitor.dir/include/cyrobot_monitor/moc_settings.cpp.o
In file included from /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/main_window.hpp:16:0,
from /home/willzoe1604/myrobot_qt/src/src/main.cpp:14:
/home/willzoe1604/myrobot_qt/build/ui_main_window.h: In member function ‘void Ui_MainWindowDesign::setupUi(QMainWindow*)’:
/home/willzoe1604/myrobot_qt/build/ui_main_window.h:714:23: error: ‘class QPushButton’ has no member named ‘setTabletTracking’
pushButton_i->setTabletTracking(false);
^
In file included from /home/willzoe1604/myrobot_qt/src/src/../include/cyrobot_monitor/main_window.hpp:16:0,
from /home/willzoe1604/myrobot_qt/src/src/main_window.cpp:15:
/home/willzoe1604/myrobot_qt/build/ui_main_window.h: In member function ‘void Ui_MainWindowDesign::setupUi(QMainWindow*)’:
/home/willzoe1604/myrobot_qt/build/ui_main_window.h:714:23: error: ‘class QPushButton’ has no member named ‘setTabletTracking’
pushButton_i->setTabletTracking(false);
^
In file included from /home/willzoe1604/myrobot_qt/build/include/cyrobot_monitor/../../../src/include/cyrobot_monitor/main_window.hpp:16:0,
from /home/willzoe1604/myrobot_qt/build/include/cyrobot_monitor/moc_main_window.cpp:9:
/home/willzoe1604/myrobot_qt/build/ui_main_window.h: In member function ‘void Ui_MainWindowDesign::setupUi(QMainWindow*)’:
/home/willzoe1604/myrobot_qt/build/ui_main_window.h:714:23: error: ‘class QPushButton’ has no member named ‘setTabletTracking’
pushButton_i->setTabletTracking(false);
^
CMakeFiles/cyrobot_monitor.dir/build.make:265: recipe for target 'CMakeFiles/cyrobot_monitor.dir/src/main_window.cpp.o' failed
make[2]: *** [CMakeFiles/cyrobot_monitor.dir/src/main_window.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/cyrobot_monitor.dir/build.make:252: recipe for target 'CMakeFiles/cyrobot_monitor.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/cyrobot_monitor.dir/src/main.cpp.o] Error 1
CMakeFiles/cyrobot_monitor.dir/build.make:369: recipe for target 'CMakeFiles/cyrobot_monitor.dir/include/cyrobot_monitor/moc_main_window.cpp.o' failed
make[2]: *** [CMakeFiles/cyrobot_monitor.dir/include/cyrobot_monitor/moc_main_window.cpp.o] Error 1
CMakeFiles/Makefile2:766: recipe for target 'CMakeFiles/cyrobot_monitor.dir/all' failed
make[1]: *** [CMakeFiles/cyrobot_monitor.dir/all] Error 2
Makefile:157: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed
下面是CMakeLists.txt
文件的内容:
##############################################################################
# CMake
##############################################################################
cmake_minimum_required(VERSION 2.8.0)
project(cyrobot_monitor)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
##############################################################################
# Catkin
##############################################################################
# qt_build provides the qt cmake glue, roscpp the comms for a default talker
find_package(catkin REQUIRED COMPONENTS rviz roscpp sensor_msgs
cv_bridge
std_msgs
image_transport
)
find_package(Qt5 REQUIRED Core Widgets Multimedia)
set(QT_LIBRARIES Qt5::Widgets Qt5::Multimedia)
include_directories(${catkin_INCLUDE_DIRS})
# Use this to define what the package will export (e.g. libs, headers).
# Since the default here is to produce only a binary, we don't worry about
# exporting anything.
catkin_package()
##############################################################################
# Qt Environment
##############################################################################
# this comes from qt_build's qt-ros.cmake which is automatically
# included via the dependency call in package.xml
#rosbuild_prepare_qt4(QtCore QtGui) # Add the appropriate components to the component list here
##############################################################################
# Sections
##############################################################################
file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui)
file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc)
file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/cyrobot_monitor/*.hpp *.h)
QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES})
QT5_WRAP_UI(QT_FORMS_HPP ${QT_FORMS})
QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC})
##############################################################################
# Sources
##############################################################################
file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp)
##############################################################################
# Binaries
##############################################################################
add_executable(cyrobot_monitor ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
target_link_libraries(cyrobot_monitor ${QT_LIBRARIES} ${catkin_LIBRARIES})
install(TARGETS cyrobot_monitor RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
更新现在版本的代码后可以正常运行
我使用的系统是Ubuntu16.04,ROS版本是Kinetic。
当我把代码克隆到src文件夹之后,在工作空间执行编译命令
catkin_make
,显示如下编译信息和错误,我应该如何正确编译呢?