boost :: read_graphml Visual Studio 2013 [英] boost::read_graphml visual studio 2013

查看:92
本文介绍了boost :: read_graphml Visual Studio 2013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

boost库工作正常,除了该函数boost :: read_graphml()表示存在问题

The boost library works fine, except for this function boost::read_graphml() it say that there is a problem

#include <iostream>
#include <iostream>
#include <string>
#include <fstream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphml.hpp>
int main()
{
using namespace boost;
typedef adjacency_list<vecS, vecS, undirectedS, no_property > Graph;
typedef dynamic_properties Dproperty;
Graph g;
Dproperty dp;

std::string file = "test.graphml";
std::ifstream t(file.c_str());
if (!t.is_open())
{
    std::cout << "loading file failed." << std::endl;
    throw "Could not load file.";
}

read_graphml(t, g, dp);

return 0;
}

错误是:

error LNK2019: unresolved external symbol "void __cdecl boost::read_graphml(class std::basic_istream<char,struct std::char_traits<char> > &,class boost::mutate_graph &,unsigned int)" (?read_graphml@boost@@YAXAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAVmutate_graph@1@I@Z) referenced in function "void __cdecl boost::read_graphml<class boost::adjacency_list<struct boost::vecS,struct boost::vecS,struct boost::directedS,struct boost::property<enum boost::vertex_name_t,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::no_property>,struct boost::no_property,struct boost::no_property,struct boost::listS> >(class std::basic_istream<char,struct std::char_traits<char> > &,class boost::adjacency_list<struct boost::vecS,struct boost::vecS,struct boost::directedS,struct boost::property<enum boost::vertex_name_t,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::no_property>,struct boost::no_property,struct boost::no_property,struct boost::listS> &,struct boost::dynamic_properties &,unsigned int)" (??$read_graphml@V?$adjacency_list@UvecS@boost@@U12@UdirectedS@2@U?$property@W4vertex_name_t@boost@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Uno_property@2@@2@Uno_property@2@U52@UlistS@2@@boost@@@boost@@YAXAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAV?$adjacency_list@UvecS@boost@@U12@UdirectedS@2@U?$property@W4vertex_name_t@boost@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Uno_property@2@@2@Uno_property@2@U52@UlistS@2@@0@AAUdynamic_properties@0@I@Z)
1>D:\_example.exe : fatal error LNK1120: 1 unresolved externals

推荐答案

您需要

  • 链接到已编译的Boost Graph库或
  • 在构建中包含BOOST_DIR/libs/graph/src/graphml.cpp.

另请参阅: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆