错误: ‘shared_ptr’ in namespace ‘std’ does not name a type的解决方法。

博客指出使用C++11标准编译时,catkin_make无法识别的问题,并给出修改方法,即需在CMakeLists.txt文件里添加相关内容。

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

这是因为要使用C++11的标准编译,而catkin_make时无法识别出来。

修改方法是在CMakeLists.txt文件里面添加:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -std=c++0x")

即可。

转载于:https://www.cnblogs.com/darklights/p/10552687.html

/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
In file included from /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/passes/topological_sort.hpp:17, from /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/source/topological_sort.cpp:7: /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp:101:10: error: ‘uintptr_t’ in namespacestddoes not name a type 101 | std::uintptr_t m_srcGraph; | ^~~~~~~~~ /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp:22:1: note:std::uintptr_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 21 | #include "typed_metadata.hpp" +++ |+#include <cstdint> 22 | /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp: In member function ‘const ade::Graph& ade::ConstTypedGraph<Types>::getCGraph() const’: /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp:106:53: error: ‘m_srcGraph’ was not declared in this scope 106 | return *reinterpret_cast<const ade::Graph*>(m_srcGraph); | ^~~~~~~~~~ /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp: In constructor ‘ade::ConstTypedGraph<Types>::ConstTypedGraph(const ade::Graph&)’: /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp:122:9: error: class ‘ade::ConstTypedGraph<Types>’ does not have any field named ‘m_srcGraph’ 122 | m_srcGraph(reinterpret_cast<std::uintptr_t>(&graph)) | ^~~~~~~~~~ /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp:122:42: error: ‘uintptr_t’ in namespacestddoes not name a type 122 | m_srcGraph(reinterpret_cast<std::uintptr_t>(&graph)) | ^~~~~~~~~ /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp:122:37: note:std::uintptr_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 122 | m_srcGraph(reinterpret_cast<std::uintptr_t>(&graph)) | ^~~ /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp: In constructor ‘ade::ConstTypedGraph<Types>::ConstTypedGraph(const ade::ConstTypedGraph<OtherTypes ...>&)’: /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp:130:9: error: class ‘ade::ConstTypedGraph<Types>’ does not have any field named ‘m_srcGraph’ 130 | m_srcGraph(other.m_srcGraph) | ^~~~~~~~~~ /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp: In instantiation of ‘ade::Graph& ade::TypedGraph<Types>::getGraph() const [with Types = {ade::passes::TopologicalSortData}]’: /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp:238:16: required from ‘ade::Graph::NodesListRange ade::TypedGraph<Types>::nodes() [with Types = {ade::passes::TopologicalSortData}; ade::Graph::NodesListRange = ade::util::Range::MapRange<ade::util::Range::IterRange<__gnu_cxx::__normal_iterator<std::shared_ptr<ade::Node>*, std::vector<std::shared_ptr<ade::Node> > > >, ade::Graph::HandleMapper>]’ /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/source/topological_sort.cpp:39:40: required from here /home/xkf/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/typed_graph.hpp:167:53: error: ‘const class ade::TypedGraph<ade::passes::TopologicalSortData>’ has no member named ‘m_srcGraph’ 167 | return *reinterpret_cast<ade::Graph*>(this->m_srcGraph); | ~~~~~~^~~~~~~~~~
最新发布
08-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值