[vtkusers] 'Undefined Reference' Error Message
Jeremy Stout
stout.jeremy at gmail.com
Wed Oct 20 10:27:50 EDT 2004
Hello, I am trying to compile a VTK program with the following line:
g++ translator.cpp -otranslator -I/usr/local/include/vtk
-I/usr/local/packages/mpich/include -L /usr/local/
lib/vtk/ -lvtkParallel -L /usr/local/packages/mpich/lib -lmpich -ldl
Unfortunately, this results in the following error messages:
In file included from /usr/include/c++/3.3.3/backward/strstream:51,
from /usr/local/include/vtk/vtkIOStream.h:36,
from /usr/local/include/vtk/vtkSystemIncludes.h:40,
from /usr/local/include/vtk/vtkIndent.h:24,
from /usr/local/include/vtk/vtkObjectBase.h:43,
from /usr/local/include/vtk/vtkObject.h:41,
from /usr/local/include/vtk/vtkMultiProcessController.h:40,
from /usr/local/include/vtk/vtkMPIController.h:43,
from translator.cpp:2:
/usr/include/c++/3.3.3/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in section
17.4.1.2 of the C++ standard. Examples include substituting the <X>
header for the <X.h> header for C++ includes, or <sstream> instead of
the deprecated header <strstream.h>. To disable this warning use
-Wno-deprecated.
/tmp/ccZVONeC.o(.text+0x11): In function `main':
: undefined reference to `vtkMPIController::New()'
/tmp/ccZVONeC.o(.text+0x36): In function `main':
: undefined reference to `vtkConeSource::New()'
The code for the program can be seen here:
#include "vtkMPIController.h"
#include "vtkConeSource.h"
#include "mpi.h"
using namespace std;
main(int argc, char* argv[])
{
vtkMPIController *controller;
bool okToContinue;
int numberOfProcesses;
int myProcessID;
controller = vtkMPIController::New();
controller->Initialize(&argc, &argv);
//Testing the Linker here
vtkConeSource *test;
test = vtkConeSource::New();
numberOfProcesses = controller->GetNumberOfProcesses();
myProcessID = controller->GetLocalProcessId();
controller->Finalize();
controller->Delete();
}
I've tried several variations on linking options, including linking in
all of the vtk libraries. If anyone could provide some assistance in
this matter, it would be greatly appreciated.
Jeremy Stout
More information about the vtkusers
mailing list