ERROR:shared_ptr does not name a type

本文解决了 C++ 中 std::string 不被识别为类型的问题,通过引入 boost 库并使用特定的头文件来修复此错误。适用于遇到类似 C++ 编译错误的开发者。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/home/zbt/S/sylar/sylar/db/mysql.h:120:9: error: ‘my_bool’ does not name a type; did you mean ‘bool’? 120 | my_bool is_null; | ^~~~~~~ | bool /home/zbt/S/sylar/sylar/db/mysql.h:121:9: error: ‘my_bool’ does not name a type; did you mean ‘bool’? 121 | my_bool error; | ^~~~~~~ | bool /home/zbt/S/sylar/sylar/db/mysql.cc: In static member function ‘static sylar::MySQLStmtRes::ptr sylar::MySQLStmtRes::Create(std::shared_ptr<sylar::MySQLStmt>)’: /home/zbt/S/sylar/sylar/db/mysql.cc:660:50: error: ‘__gnu_cxx::__alloc_traits<std::allocator<sylar::MySQLStmtRes::Data>, sylar::MySQLStmtRes::Data>::value_type’ {aka ‘struct sylar::MySQLStmtRes::Data’} has no member named ‘is_null’ 660 | rt->m_binds[i].is_null = &rt->m_datas[i].is_null; | ^~~~~~~ /home/zbt/S/sylar/sylar/db/mysql.cc:661:48: error: ‘__gnu_cxx::__alloc_traits<std::allocator<sylar::MySQLStmtRes::Data>, sylar::MySQLStmtRes::Data>::value_type’ {aka ‘struct sylar::MySQLStmtRes::Data’} has no member named ‘error’ 661 | rt->m_binds[i].error = &rt->m_datas[i].error; | ^~~~~ /home/zbt/S/sylar/sylar/db/mysql.cc: In member function ‘virtual bool sylar::MySQLStmtRes::isNull(int)’: /home/zbt/S/sylar/sylar/db/mysql.cc:700:25: error: ‘__gnu_cxx::__alloc_traits<std::allocator<sylar::MySQLStmtRes::Data>, sylar::MySQLStmtRes::Data>::value_type’ {aka ‘struct sylar::MySQLStmtRes::Data’} has no member named ‘is_null’ 700 | return m_datas[idx].is_null; | ^~~~~~~ /home/zbt/S/sylar/sylar/db/mysql.cc: In constructor ‘sylar::MySQLStmtRes::Data::Data()’: /home/zbt/S/sylar/sylar/db/mysql.cc:766:6: error: class ‘sylar::MySQLStmtRes::Data’ does not have any field named ‘is_null’ 766 | :is_null(0) | ^~~~~~~ /home/zbt/S/sylar/sylar/db/mysql.cc:767:6: error: class ‘sylar::MySQLStmtRes::Data’ does not have any field named ‘error’ 767 | ,error(0) | ^~~~~ make[2]: *** [CMakeFiles/sylar.dir/build.make:137: CMakeFiles/sylar.dir/sylar/db/mysql.cc.o] Error 1 make[2]: Leaving directory '/home/zbt/S/sylar' make[1]: *** [CMakeFiles/Makefile2:248: CMakeFiles/sylar.dir/all] Error 2 make[1]: Leaving directory '/home/zbt/S/sylar' make: *** [Makefile:87: all] Error 2
最新发布
07-22
--- stderr: card_drawing2 In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/11/algorithm:74, from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:18, 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/f972/assi_ws/src/card_drawing2/src/card_server.cpp:1: /usr/include/c++/11/functional: In instantiation of ‘struct std::_Bind_check_arity<void (CardServer::*)(std::shared_ptr<card_interface::srv::String_Response_<std::allocator<void> > >), CardServer*, const std::_Placeholder<1>&, const std::_Placeholder<2>&>’: /usr/include/c++/11/functional:768:12: required from ‘struct std::_Bind_helper<false, void (CardServer::*)(std::shared_ptr<card_interface::srv::String_Response_<std::allocator<void> > >), CardServer*, const std::_Placeholder<1>&, const std::_Placeholder<2>&>’ /usr/include/c++/11/functional:789:5: required by substitution of ‘template<class _Func, class ... _BoundArgs> typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type std::bind(_Func&&, _BoundArgs&& ...) [with _Func = void (CardServer::*)(std::shared_ptr<card_interface::srv::String_Response_<std::allocator<void> > >); _BoundArgs = {CardServer*, const std::_Placeholder<1>&, const std::_Placeholder<2>&}]’ /home/f972/assi_ws/src/card_drawing2/src/card_server.cpp:13:38: required from here /usr/include/c++/11/functional:756:21: error: static assertion failed: Wrong number of arguments for pointer-to-member 755 | static_assert(_Varargs::value | ~~~~~ 756 | ? sizeof...(_BoundArgs) >= _Arity::value + 1 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
03-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值