[vtkusers] gcc linker errors with vtk 4.0

Swegle Valentin M 2dLt AFRL/HEDB Valentin.Swegle at brooks.af.mil
Fri Aug 23 12:01:30 EDT 2002


Hi, All.

  I've compiled vtk 4.0 and it runs examples correctly in tcl.  For the life
of me, though, I can't get any c++ program using vtk to compile, including
the examples.    Does anybody have any insight?

Thanks much,
  Valentin

The errors I'm getting:

[root at valallah Playtime]# gcc test.cxx -o test
/tmp/ccStHUPr.o: In function `main':
/tmp/ccStHUPr.o(.text+0x55): undefined reference to 
`vtkImageReader2::New(void)'
/tmp/ccStHUPr.o(.text+0x97): undefined reference to 
`vtkImageReader2::SetFileName(char const *)'
collect2: ld returned 1 exit status


The version I'm running:

[root at valallah Playtime]# gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)

This is VTK 4.0.


The program I'm trying to compile:

#include <stdlib.h>
#include <string.h>
#include "vtkImageReader2.h"

int
main (int argc, char *argv[])
{
     char titleModelTissue[40];  
     vtkImageReader2 *reader;

     strncpy(titleModelTissue, "monkeyhead0112x0113x0126.raw", titleSize - 
1);

     reader = vtkImageReader2::New();
     reader->SetDataExtent(0,125,0,112,0,111);
     reader->SetFileName(titleModelTissue);
     reader->SetDataSpacing(sx,sy,sz);

     return(0);
}




More information about the vtkusers mailing list