<div class="gmail_quote">Hello everybody,<br>I hope this is the right place to ask this question. If a similar question was answered before please let me know the address of it.<br><br><div class="gmail_quote">I am trying to compile the attached program (which is one of Kitware's sample programs). I mainly aim to use VTK's BGL related algorithms with my graphs. But I could not compile this code. I have vtk5.2 and bgl 1.37 (and 1.36). <br>
<br>When I compile the sample file, I get the first error for the following line:<br>
VTK_CREATE(vtkBoostBiconnectedComponents, biconn);<br><div><br>(On CMake, I had set VTK_USE_BOOST set to ON when building VTK)<br></div><br>Have you seen an error like this? Do you think there is a problem with my boost installation. I will appreciate your help.<br>
Thanks a lot.<br>
Aytekin<br><br>I am getting the following linking errors. The sample program starts right after the error mesage (I think copying it to here was the easiest and least confusing way).<br><br>------------- Error Message starts here ------------- <br>
<br>1>Compiling...<br>1>bgl.cxx<br>1>Linking...<br>1>bgl.obj : error LNK2019: unresolved external symbol "public: static class vtkBoostBiconnectedComponents * __cdecl vtkBoostBiconnectedComponents::New(void)" (?New@vtkBoostBiconnectedComponents@@SAPAV1@XZ) referenced in function "public: static class vtkSmartPointer<class vtkBoostBiconnectedComponents> __cdecl vtkSmartPointer<class vtkBoostBiconnectedComponents>::New(void)" (?New@?$vtkSmartPointer@VvtkBoostBiconnectedComponents@@@@SA?AV1@XZ)<br>
<br>1>bgl.obj : error LNK2019: unresolved external symbol "public: static class vtkBoostBreadthFirstSearch * __cdecl vtkBoostBreadthFirstSearch::New(void)" (?New@vtkBoostBreadthFirstSearch@@SAPAV1@XZ) referenced in function "public: static class vtkSmartPointer<class vtkBoostBreadthFirstSearch> __cdecl vtkSmartPointer<class vtkBoostBreadthFirstSearch>::New(void)" (?New@?$vtkSmartPointer@VvtkBoostBreadthFirstSearch@@@@SA?AV1@XZ)<br>
<br>1>bgl.obj : error LNK2019: unresolved external symbol "public: static class vtkBoostBrandesCentrality * __cdecl vtkBoostBrandesCentrality::New(void)" (?New@vtkBoostBrandesCentrality@@SAPAV1@XZ) referenced in function "public: static class vtkSmartPointer<class vtkBoostBrandesCentrality> __cdecl vtkSmartPointer<class vtkBoostBrandesCentrality>::New(void)" (?New@?$vtkSmartPointer@VvtkBoostBrandesCentrality@@@@SA?AV1@XZ)<br>
<br>1>bgl.obj : error LNK2019: unresolved external symbol "public: static class vtkBoostConnectedComponents * __cdecl vtkBoostConnectedComponents::New(void)" (?New@vtkBoostConnectedComponents@@SAPAV1@XZ) referenced in function "public: static class vtkSmartPointer<class vtkBoostConnectedComponents> __cdecl vtkSmartPointer<class vtkBoostConnectedComponents>::New(void)" (?New@?$vtkSmartPointer@VvtkBoostConnectedComponents@@@@SA?AV1@XZ)<br>
<br>1>bgl.obj : error LNK2019: unresolved external symbol "public: static class vtkBoostBreadthFirstSearchTree * __cdecl vtkBoostBreadthFirstSearchTree::New(void)" (?New@vtkBoostBreadthFirstSearchTree@@SAPAV1@XZ) referenced in function "public: static class vtkSmartPointer<class vtkBoostBreadthFirstSearchTree> __cdecl vtkSmartPointer<class vtkBoostBreadthFirstSearchTree>::New(void)" (?New@?$vtkSmartPointer@VvtkBoostBreadthFirstSearchTree@@@@SA?AV1@XZ)<br>
<br>1>C:\network\C++\bgl\bin\Release\bgl.exe : fatal error LNK1120: 5 unresolved externals<br><br>1>Build log was saved at "file://c:\network\C++\bgl\bin\bgl.dir\Release\BuildLog.htm"<br>1>bgl - 6 error(s), 0 warning(s)<br>
2>------ Skipped Build: Project: ALL_BUILD, Configuration: Release Win32 ------<br>2>Project not selected to build for this solution configuration <br>========== Build: 0 succeeded, 1 failed, 1 up-to-date, 1 skipped ==========<br>
</div><br>------------- Error Message Ends here ------------- <br><br><br>Here is the program:<br><br>/*=========================================================================<br><br> Program: Visualization Toolkit<br>
Module: $RCSfile: TestBoostAlgorithms.cxx,v $<br><br> Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br> All rights reserved.<br> See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br> This software is distributed WITHOUT ANY WARRANTY; without even<br> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br> PURPOSE. See the above copyright notice for more information.<br>
<br>=========================================================================*/<br>/*-------------------------------------------------------------------------<br> Copyright 2008 Sandia Corporation.<br> Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,<br>
the U.S. Government retains certain rights in this software.<br>-------------------------------------------------------------------------*/<br>#include "vtkActor.h"<br>#include "vtkBoostBrandesCentrality.h"<br>
#include "vtkBoostBreadthFirstSearch.h"<br>#include "vtkBoostBreadthFirstSearchTree.h"<br>#include "vtkBoostConnectedComponents.h"<br>#include "vtkGlyph3D.h"<br>#include "vtkGlyphSource2D.h"<br>
#include "vtkGraphToPolyData.h"<br>#include "vtkGraphWriter.h"<br>#include "vtkMutableUndirectedGraph.h"<br>#include "vtkPolyDataMapper.h"<br>#include "vtkProperty.h"<br>#include "vtkRegressionTestImage.h"<br>
#include "vtkRenderer.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkSmartPointer.h"<br><br>#include <boost/version.hpp><br>#include "vtkBoostBiconnectedComponents.h"<br>
<br>#define VTK_CREATE(type,name) \<br> vtkSmartPointer<type> name = vtkSmartPointer<type>::New()<br><br>template <typename Algorithm><br>void RenderGraph(vtkRenderer* ren, Algorithm* alg, <br> double xoffset, double yoffset, <br>
const char* vertColorArray, double vertMin, double vertMax, <br> const char* edgeColorArray, double edgeMin, double edgeMax)<br>{<br> VTK_CREATE(vtkGraphToPolyData, graphToPoly);<br> graphToPoly->SetInputConnection(alg->GetOutputPort());<br>
<br> VTK_CREATE(vtkGlyphSource2D, glyph);<br> glyph->SetGlyphTypeToVertex();<br> VTK_CREATE(vtkGlyph3D, vertexGlyph);<br> vertexGlyph->SetInputConnection(0, graphToPoly->GetOutputPort());<br> vertexGlyph->SetInputConnection(1, glyph->GetOutputPort());<br>
VTK_CREATE(vtkPolyDataMapper, vertexMapper);<br> vertexMapper->SetInputConnection(vertexGlyph->GetOutputPort());<br> vertexMapper->SetScalarModeToUsePointFieldData();<br> if (vertColorArray)<br> {<br> vertexMapper->SelectColorArray(vertColorArray);<br>
vertexMapper->SetScalarRange(vertMin, vertMax);<br> }<br> VTK_CREATE(vtkActor, vertexActor);<br> vertexActor->SetMapper(vertexMapper);<br> vertexActor->GetProperty()->SetPointSize(10.0);<br> vertexActor->SetPosition(xoffset, yoffset, 0.001);<br>
<br> VTK_CREATE(vtkPolyDataMapper, edgeMapper);<br> edgeMapper->SetInputConnection(graphToPoly->GetOutputPort());<br> edgeMapper->SetScalarModeToUseCellFieldData();<br> if (edgeColorArray)<br> {<br> edgeMapper->SelectColorArray(edgeColorArray);<br>
edgeMapper->SetScalarRange(edgeMin, edgeMax);<br> }<br> VTK_CREATE(vtkActor, edgeActor);<br> edgeActor->SetMapper(edgeMapper);<br> edgeActor->SetPosition(xoffset, yoffset, 0);<br><br> ren->AddActor(vertexActor);<br>
ren->AddActor(edgeActor);<br>}<br><br>int main(int argc, char* argv[])<br>{<br> // Create the test graph<br> VTK_CREATE(vtkMutableUndirectedGraph, g);<br><br> VTK_CREATE(vtkPoints, pts);<br> g->AddVertex();<br>
pts->InsertNextPoint(0, 1, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(0.5, 1, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(0.25, 0.5, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(0, 0, 0);<br>
g->AddVertex();<br> pts->InsertNextPoint(0.5, 0, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(1, 0, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(0.75, 0.5, 0);<br> g->SetPoints(pts);<br>
<br> g->AddEdge(0, 1);<br> g->AddEdge(0, 2);<br> g->AddEdge(1, 2);<br> g->AddEdge(2, 3);<br> g->AddEdge(2, 4);<br> g->AddEdge(3, 4);<br><br> VTK_CREATE(vtkRenderer, ren);<br><br> // Test biconnected components<br>
// Only available in Boost 1.33 or later<br> VTK_CREATE(vtkBoostBiconnectedComponents, biconn);<br> biconn->SetInput(g);<br> RenderGraph(ren, biconn.GetPointer(), 0, 0, "biconnected component", -1, 3, "biconnected component", -1, 3);<br>
<br><br> // Test breadth first search<br> VTK_CREATE(vtkBoostBreadthFirstSearch, bfs);<br> bfs->SetInput(g);<br> RenderGraph(ren, bfs.GetPointer(), 2, 0, "BFS", 0, 3, NULL, 0, 0);<br><br> // Test centrality<br>
VTK_CREATE(vtkBoostBrandesCentrality, centrality);<br> centrality->SetInput(g);<br> RenderGraph(ren, centrality.GetPointer(), 0, 2, "centrality", 0, 1, NULL, 0, 0);<br><br> // Test connected components<br>
VTK_CREATE(vtkBoostConnectedComponents, comp);<br> comp->SetInput(g);<br> RenderGraph(ren, comp.GetPointer(), 2, 2, "component", 0, 2, NULL, 0, 0);<br><br> // Test breadth first search tree<br> VTK_CREATE(vtkBoostBreadthFirstSearchTree, bfsTree);<br>
bfsTree->SetInput(g);<br> VTK_CREATE(vtkBoostBreadthFirstSearch, bfs2);<br> bfs2->SetInputConnection(bfsTree->GetOutputPort());<br> RenderGraph(ren, bfs2.GetPointer(), 0, 4, "BFS", 0, 3, NULL, 0, 0);<br>
<br> VTK_CREATE(vtkRenderWindowInteractor, iren);<br> VTK_CREATE(vtkRenderWindow, win);<br> win->AddRenderer(ren);<br> win->SetInteractor(iren);<br><br> win->Render();<br><br> int retVal = vtkRegressionTestImage(win);<br>
if (retVal == vtkRegressionTester::DO_INTERACTOR)<br> {<br> win->Render();<br> iren->Start();<br> retVal = vtkRegressionTester::PASSED;<br> }<br><br> return !retVal;<br>}<br><br><br></div><br>