Consolidate compiler generated dependencies of target cpp_node
[ 50%] Building CXX object CMakeFiles/cpp_node.dir/src/cpp_node.cpp.o
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp: In function ‘int main(int, char**)’:
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:6:47: error: expected ‘,’ or ‘;’ before ‘{’ token
6 | auto node = std::make_shared<rclcpp::Node>{"cpp_node"};
| ^
In file included from /opt/ros/humble/include/rclcpp/rclcpp/client.hpp:40,
from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:24,
from /opt/ros/humble/include/rclcpp/rclcpp/any_executable.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategy.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategies.hpp:18,
from /opt/ros/humble/include/rclcpp/rclcpp/executor_options.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:37,
from /opt/ros/humble/include/rclcpp/rclcpp/executors/multi_threaded_executor.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:21,
from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155,
from /home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:1:
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:7:23: error: request for member ‘get_logger’ in ‘* node’, which is of non-class type ‘std::shared_ptr<rclcpp::Node>()’
7 | RCLCPP_INFO(node->get_logger(),"你好C++节点!");
| ^~~~~~~~~~
/opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:517:40: note: in definition of macro ‘RCLCPP_INFO’
517 | ::std::is_convertible_v<decltype(logger), ::rclcpp::Logger>, \
| ^~~~~~
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:7:23: error: request for member ‘get_logger’ in ‘* node’, which is of non-class type ‘std::shared_ptr<rclcpp::Node>()’
7 | RCLCPP_INFO(node->get_logger(),"你好C++节点!");
| ^~~~~~~~~~
/opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:517:40: note: in definition of macro ‘RCLCPP_INFO’
517 | ::std::is_convertible_v<decltype(logger), ::rclcpp::Logger>, \
| ^~~~~~
/opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:517:14: error: template argument 1 is invalid
517 | ::std::is_convertible_v<decltype(logger), ::rclcpp::Logger>, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:7:5: note: in expansion of macro ‘RCLCPP_INFO’
7 | RCLCPP_INFO(node->get_logger(),"你好C++节点!");
| ^~~~~~~~~~~
In file included from /opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:24,
from /opt/ros/humble/include/rclcpp/rclcpp/client.hpp:40,
from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:24,
from /opt/ros/humble/include/rclcpp/rclcpp/any_executable.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategy.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategies.hpp:18,
from /opt/ros/humble/include/rclcpp/rclcpp/executor_options.hpp:20,
from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:37,
from /opt/ros/humble/include/rclcpp/rclcpp/executors/multi_threaded_executor.hpp:25,
from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:21,
from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155,
from /home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:1:
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:7:23: error: request for member ‘get_logger’ in ‘* node’, which is of non-class type ‘std::shared_ptr<rclcpp::Node>()’
7 | RCLCPP_INFO(node->get_logger(),"你好C++节点!");
| ^~~~~~~~~~
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:7:5: note: in expansion of macro ‘RCLCPP_INFO’
7 | RCLCPP_INFO(node->get_logger(),"你好C++节点!");
| ^~~~~~~~~~~
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:7:23: error: request for member ‘get_logger’ in ‘* node’, which is of non-class type ‘std::shared_ptr<rclcpp::Node>()’
7 | RCLCPP_INFO(node->get_logger(),"你好C++节点!");
| ^~~~~~~~~~
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:7:5: note: in expansion of macro ‘RCLCPP_INFO’
7 | RCLCPP_INFO(node->get_logger(),"你好C++节点!");
| ^~~~~~~~~~~
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:8:17: error: no matching function for call to ‘spin(std::shared_ptr<rclcpp::Node> (*&)())’
8 | rclcpp::spin(node);
| ~~~~~~~~~~~~^~~~~~
In file included from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155,
from /home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:1:
/opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:45:1: note: candidate: ‘void rclcpp::spin(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr)’
45 | spin(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr);
| ^~~~
/opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:45:60: note: no known conversion for argument 1 from ‘std::shared_ptr<rclcpp::Node> (*)()’ to ‘rclcpp::node_interfaces::NodeBaseInterface::SharedPtr’ {aka ‘std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>’}
45 | spin(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:49:1: note: candidate: ‘void rclcpp::spin(rclcpp::Node::SharedPtr)’
49 | spin(rclcpp::Node::SharedPtr node_ptr);
| ^~~~
/opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:49:30: note: no known conversion for argument 1 from ‘std::shared_ptr<rclcpp::Node> (*)()’ to ‘rclcpp::Node::SharedPtr’ {aka ‘std::shared_ptr<rclcpp::Node>’}
49 | spin(rclcpp::Node::SharedPtr node_ptr);
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/c++allocator.h:33,
from /usr/include/c++/11/bits/allocator.h:46,
from /usr/include/c++/11/memory:64,
from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:153,
from /home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:1:
/usr/include/c++/11/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = rclcpp::Node; _Args = {}; _Tp = rclcpp::Node]’:
/usr/include/c++/11/bits/alloc_traits.h:516:17: required from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(std::allocator_traits<std::allocator<_Tp1> >::allocator_type&, _Up*, _Args&& ...) [with _Up = rclcpp::Node; _Args = {}; _Tp = rclcpp::Node; std::allocator_traits<std::allocator<_Tp1> >::allocator_type = std::allocator<rclcpp::Node>]’
/usr/include/c++/11/bits/shared_ptr_base.h:519:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {}; _Tp = rclcpp::Node; _Alloc = std::allocator<rclcpp::Node>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/include/c++/11/bits/shared_ptr_base.h:650:16: required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = rclcpp::Node; _Alloc = std::allocator<rclcpp::Node>; _Args = {}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/include/c++/11/bits/shared_ptr_base.h:1342:14: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<rclcpp::Node>; _Args = {}; _Tp = rclcpp::Node; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/include/c++/11/bits/shared_ptr.h:409:59: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<rclcpp::Node>; _Args = {}; _Tp = rclcpp::Node]’
/usr/include/c++/11/bits/shared_ptr.h:862:14: required from ‘std::shared_ptr<_Tp> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = rclcpp::Node; _Alloc = std::allocator<rclcpp::Node>; _Args = {}]’
/usr/include/c++/11/bits/shared_ptr.h:878:39: required from ‘std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp = rclcpp::Node; _Args = {}]’
/home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:6:22: required from here
/usr/include/c++/11/ext/new_allocator.h:162:11: error: no matching function for call to ‘rclcpp::Node::Node()’
162 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ros/humble/include/rclcpp/rclcpp/executors/single_threaded_executor.hpp:28,
from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:22,
from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155,
from /home/cyt/chapt2/demo_cpp_pkg/src/cpp_node.cpp:1:
/opt/ros/humble/include/rclcpp/rclcpp/node.hpp:1294:3: note: candidate: ‘rclcpp::Node::Node(const rclcpp::Node&, const string&)’
1294 | Node(
| ^~~~
/opt/ros/humble/include/rclcpp/rclcpp/node.hpp:1294:3: note: candidate expects 2 arguments, 0 provided
/opt/ros/humble/include/rclcpp/rclcpp/node.hpp:101:12: note: candidate: ‘rclcpp::Node::Node(const string&, const string&, const rclcpp::NodeOptions&)’
101 | explicit Node(
| ^~~~
/opt/ros/humble/include/rclcpp/rclcpp/node.hpp:101:12: note: candidate expects 3 arguments, 0 provided
/opt/ros/humble/include/rclcpp/rclcpp/node.hpp:89:12: note: candidate: ‘rclcpp::Node::Node(const string&, const rclcpp::NodeOptions&)’
89 | explicit Node(
| ^~~~
/opt/ros/humble/include/rclcpp/rclcpp/node.hpp:89:12: note: candidate expects 2 arguments, 0 provided
make[2]: *** [CMakeFiles/cpp_node.dir/build.make:76:CMakeFiles/cpp_node.dir/src/cpp_node.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:137:CMakeFiles/cpp_node.dir/all] 错误 2
make: *** [Makefile:146:all] 错误 2