When trying to do the boost read_graphviz example at Read grahviz example in Visual Studio on Windows, I get linker errors.
I've build the boost library and referenced it "\boost_1_72_0" under C/C++ -> General -> Additional Include Directories. I've linked the libraries "boost_1_72_0\stage\lib" under Linker -> General -> Additional Library Directories.
However, when compiling I get this:
LNK2019 unresolved external symbol "bool __cdecl boost::detail::graph::read_graphviz_new(class std::basic_string,class std::allocator > const &,class boost::detail::graph::mutate_graph *)"
I got it working by referencing the read_graphviz implementation directly "libs/graph/src/read_graphviz_new.cpp" as seen in the example below, as suggested here SO - can-not-link-boost-graph-library-for-read-graphviz-example.
Referencing the implementation directly seems like a bad solution. Other parts of the boost graph library can be used fine without referencing the implementation.
How can I use the boost read_graphviz without referencing the implementation directly?
#include <iostream>
#include <boost\graph\graph_traits.hpp>
#include <boost\graph\adjacency_list.hpp>
#include <boost\graph\dijkstra_shortest_paths.hpp>
#include <boost\graph\graphviz.hpp>
#include <libs\graph\src\read_graphviz_new.cpp>
using namespace boost;
using namespace std;
int main()
{
typedef property < vertex_name_t, std::string, property < vertex_color_t, float > > vertex_p;
typedef property < edge_weight_t, double > edge_p;
typedef property < graph_name_t, std::string > graph_p;
typedef adjacency_list < vecS, vecS, directedS, vertex_p, edge_p, graph_p > graph_t;
graph_t graph(0);
dynamic_properties dp;
property_map<graph_t, vertex_name_t>::type name = get(vertex_name, graph);
dp.property("node_id", name);
ref_property_map<graph_t*, std::string> gname(get_property(graph, graph_name));
dp.property("name", gname);
std::istringstream gvgraph("digraph { graph [name=\"graphname\"] a c e }");
bool status = read_graphviz(gvgraph, graph, dp, "node_id");
}