[Insight-users] GettingStarted-II compilation problem
Luis Ibanez
luis.ibanez at kitware.com
Thu, 29 Jan 2004 09:20:51 -0500
Hi David,
The error messages indicate that the
compiler have not found the declaration
of the class ImageToVTKImage.
Didn't you get a message saying that the
header file "itkImageToVTKImageFilter.h"
wasn't found ?
This is the typical cause for these errors.
In order to compile this example, the
simplest thing to do is to copy the
files
itkImageToVTKImageFilter.h
itkImageToVTKImageFilter.txx
in the same directory where your .cxx
file is. These files are available at
InsightApplications/Auxiliary/vtk
The reason why these files are not
along with the basic source tree of
ITK is that they are a bridge between
ITK and VTK. Putting these files into
ITK will create an artificial dependendy
between ITK and VTK.
Please let us know if you still find
any problems after copying these files
into your directory.
Thanks
Luis
------------------
David Macias Verde wrote:
> Hi all:
>
> I am new to itk and I have a very elemental question. When compiling the
> source coming in the GettingStarted-II presentation
> (/InsightDocuments/CourseWare/Training/
> <http://www.itk.org/cgi-bin/cvsweb.cgi/InsightDocuments/CourseWare/Training/GettingStarted-V.ppt?cvsroot=Insight>),
> which is
>
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> #include "itkImageToVTKImageFilter.h"
>
> #include "vtkImageViewer.h"
> #include "vtkRenderWindowInteractor.h"
>
> int main( int argc, char **argv ) {
>
> typedef itk::Image <unsigned short,2> ImageType;
> typedef itk::ImageFileReader <ImageType> ReaderType;
> typedef itk::ImageToVTKImageFilter <ImageType> ConnectorType;
>
> ReaderType::Pointer reader = ReaderType::New();
> ConnectorType::Pointer connector = ConnectorType::New();
>
> reader->SetFileName( argv[1] );
> connector->SetInput( reader->GetOutput() );
>
> vtkImageViewer * viewer = vtkImageViewer::New();
>
> vtkRenderWindowInteractor * renderWindowInteractor =
> vtkRenderWindowInteractor::New();
>
> viewer->SetupInteractor( renderWindowInteractor );
> viewer->SetInput( connector->GetOutput() );
>
> viewer->Render();
> viewer->SetColorWindow( 255 );
> viewer->SetColorLevel( 128 );
> renderWindowInteractor->Start();
>
> return 0;
> }
>
> I get the following message.
>
> prueba.cxx: In function `int main(int, char**)':
> prueba.cxx:12: error: ISO C++ forbids declaration of `ImageToVTKImageFilter'
> with no type
> prueba.cxx:12: error: template-id `ImageToVTKImageFilter<main(int,
> char**)::ImageType>' used as a declarator
> prueba.cxx:12: error: syntax error before `;' token
> prueba.cxx:15: error: `ConnectorType' undeclared (first use this function)
> prueba.cxx:15: error: (Each undeclared identifier is reported only once for
> each function it appears in.)
> prueba.cxx:15: error: syntax error before `::' token
> prueba.cxx:18: error: `connector' undeclared (first use this function)
> prueba.cxx:8: warning: unused parameter `int argc'
> make: *** [prueba.o] Error 1
>
> I think I have all the libraries and includes right directed. May
> someone please give me a hand?
>
> Cheers,
> --
> David Macias Verde <_david.maciasverde at gobiernodecanarias.org_
> <mailto:david.maciasverde at gobiernodecanarias.org>>
> Servicio de Física Médica - Hospital de Gran Canaria Dr. Negrín
>
>
>