Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/135.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 无法链接read_graphviz()示例的Boost图形库_C++_Boost_Graphviz_Boost Graph - Fatal编程技术网

C++ 无法链接read_graphviz()示例的Boost图形库

C++ 无法链接read_graphviz()示例的Boost图形库,c++,boost,graphviz,boost-graph,C++,Boost,Graphviz,Boost Graph,我试图用read_graphviz做一个例子,但我无法帮助链接器将read_graphviz函数调用链接到正确的read_graphviz版本 目前,read_graphviz有三个模板版本: 名称空间提升{ template <typename MutableGraph> bool read_graphviz(std::istream& in, MutableGraph& graph, dynamic_propert

我试图用read_graphviz做一个例子,但我无法帮助链接器将read_graphviz函数调用链接到正确的read_graphviz版本

目前,read_graphviz有三个模板版本: 名称空间提升{

  template <typename MutableGraph>
  bool read_graphviz(std::istream& in, MutableGraph& graph,
                     dynamic_properties& dp,
                     const std::string& node_id = "node_id");

  template <typename MutableGraph>
  bool read_graphviz(std::string& str, MutableGraph& graph,
                     dynamic_properties& dp,
                     const std::string& node_id = "node_id");

  template <typename InputIterator, typename MutableGraph>
  bool read_graphviz(InputIterator begin, InputIterator end,
                     MutableGraph& graph, dynamic_properties& dp,
                     const std::string& node_id = "node_id");
}
错误:

/tmp/cctwokpF.o: In function `bool boost::read_graphviz_new<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_index_t, int, boost::no_property>, boost::property<boost::edge_index_t, int, boost::no_property>, boost::no_property, boost::listS> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_index_t, int, boost::no_property>, boost::property<boost::edge_index_t, int, boost::no_property>, boost::no_property, boost::listS>&, boost::dynamic_properties&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
main.cpp:(.text._ZN5boost17read_graphviz_newINS_14adjacency_listINS_4vecSES2_NS_11undirectedSENS_8propertyINS_14vertex_index_tEiNS_11no_propertyEEENS4_INS_12edge_index_tEiS6_EES6_NS_5listSEEEEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERT_RNS_18dynamic_propertiesESJ_[_ZN5boost17read_graphviz_newINS_14adjacency_listINS_4vecSES2_NS_11undirectedSENS_8propertyINS_14vertex_index_tEiNS_11no_propertyEEENS4_INS_12edge_index_tEiS6_EES6_NS_5listSEEEEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERT_RNS_18dynamic_propertiesESJ_]+0x80): undefined reference to `boost::detail::graph::read_graphviz_new(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::detail::graph::mutate_graph*)'
collect2: error: ld returned 1 exit status
/tmp/cctwokpF.o:在函数“bool boost::read_graphviz_new(std::_cx11::basic_string const&,boost::adjacence_list&,boost::dynamic_properties&,std:_cx11::basic_string const&”)中:
main.cpp:(.text.)_[ZN5Boost17读取图形、新的邻接列表、矢量表、无方向传感器、顶点索引、无属性、边缘索引、列表、基本字符串、动态属性]+0xBoost::graph::undefined detail(std::uucxx11::basic_u字符串常量&,boost::detail::graph::mutate_graph*)
collect2:错误:ld返回了1个退出状态

您需要链接功能的实现

最简单的方法是将其包括在内:

#include  <libs/graph/src/read_graphviz_new.cpp>
#包括

如果您想要更多的示例来获得灵感:

我试图将其包含在内,但找不到main.cpp:14:49:致命错误:libs/graph/src/read_graphviz\u new.cpp:没有这样的文件或目录#include^编译已终止。@Angelos规范的方法是链接
libboost\u grap.a//.dll
。在Win32上,这应该是自动的。在linux上,包括我说的文件绝对是最简单的,但它需要Boost发行版存档。如果没有,请使用预构建库-无论您从何处安装Boost,如果您没有自己构建它。thx作为您的答复。我使用的是Arch linux,我已经安装了Boost库来自Arch repository的。链接器需要标记
-lboost\u graph
,我没有新建它,但当您告诉我关于
libboost\u grap.a/.so/.dll
时,我找到了它。如果添加该标记,则不需要
\include
/tmp/cctwokpF.o: In function `bool boost::read_graphviz_new<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_index_t, int, boost::no_property>, boost::property<boost::edge_index_t, int, boost::no_property>, boost::no_property, boost::listS> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_index_t, int, boost::no_property>, boost::property<boost::edge_index_t, int, boost::no_property>, boost::no_property, boost::listS>&, boost::dynamic_properties&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
main.cpp:(.text._ZN5boost17read_graphviz_newINS_14adjacency_listINS_4vecSES2_NS_11undirectedSENS_8propertyINS_14vertex_index_tEiNS_11no_propertyEEENS4_INS_12edge_index_tEiS6_EES6_NS_5listSEEEEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERT_RNS_18dynamic_propertiesESJ_[_ZN5boost17read_graphviz_newINS_14adjacency_listINS_4vecSES2_NS_11undirectedSENS_8propertyINS_14vertex_index_tEiNS_11no_propertyEEENS4_INS_12edge_index_tEiS6_EES6_NS_5listSEEEEEbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERT_RNS_18dynamic_propertiesESJ_]+0x80): undefined reference to `boost::detail::graph::read_graphviz_new(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::detail::graph::mutate_graph*)'
collect2: error: ld returned 1 exit status
#include  <libs/graph/src/read_graphviz_new.cpp>