[Insight-users] GettingStarted-II compilation problem
David Macias Verde
dmacver at gobiernodecanarias.org
Thu, 29 Jan 2004 11:08:30 +0000
--=-Jvh3F9F6ZikW8G3OgbMN
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
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/), 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 =3D ReaderType::New();
ConnectorType::Pointer connector =3D ConnectorType::New();
=20
reader->SetFileName( argv[1] );
connector->SetInput( reader->GetOutput() );
vtkImageViewer * viewer =3D vtkImageViewer::New();
=20
vtkRenderWindowInteractor * renderWindowInteractor =3D
vtkRenderWindowInteractor::New();
viewer->SetupInteractor( renderWindowInteractor );
viewer->SetInput( connector->GetOutput() );
viewer->Render();
viewer->SetColorWindow( 255 );
viewer->SetColorLevel( 128 );
renderWindowInteractor->Start();
=20
return 0;
}
I get the following message.=20
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,
--=20
David Macias Verde <david.maciasverde at gobiernodecanarias.org>
Servicio de F=EDsica M=E9dica - Hospital de Gran Canaria Dr. Negr=EDn
--=-Jvh3F9F6ZikW8G3OgbMN
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.0.9">
</HEAD>
<BODY>
Hi all:<BR>
<BR>
I am new to itk and I have a very elemental question. When compiling the source coming in the GettingStarted-II presentation (/<A HREF="http://www.itk.org/cgi-bin/cvsweb.cgi/InsightDocuments/CourseWare/Training/GettingStarted-V.ppt?cvsroot=Insight">InsightDocuments/CourseWare/Training/</A>), which is<BR>
<BR>
<FONT COLOR="#ff0000">#include "itkImage.h"<BR>
#include "itkImageFileReader.h"<BR>
#include "itkImageToVTKImageFilter.h"<BR>
<BR>
#include "vtkImageViewer.h"<BR>
#include "vtkRenderWindowInteractor.h"<BR>
<BR>
int main( int argc, char **argv ) {<BR>
<BR>
typedef itk::Image <unsigned short,2> ImageType;<BR>
typedef itk::ImageFileReader <ImageType> ReaderType;<BR>
typedef itk::ImageToVTKImageFilter <ImageType> ConnectorType;<BR>
<BR>
ReaderType::Pointer reader = ReaderType::New();<BR>
ConnectorType::Pointer connector = ConnectorType::New();<BR>
<BR>
reader->SetFileName( argv[1] );<BR>
connector->SetInput( reader->GetOutput() );<BR>
<BR>
vtkImageViewer * viewer = vtkImageViewer::New();<BR>
<BR>
vtkRenderWindowInteractor * renderWindowInteractor = vtkRenderWindowInteractor::New();<BR>
<BR>
viewer->SetupInteractor( renderWindowInteractor );<BR>
viewer->SetInput( connector->GetOutput() );<BR>
<BR>
viewer->Render();<BR>
viewer->SetColorWindow( 255 );<BR>
viewer->SetColorLevel( 128 );<BR>
renderWindowInteractor->Start();<BR>
<BR>
return 0;<BR>
}</FONT><BR>
<BR>
I get the following message. <BR>
<BR>
<FONT COLOR="#ff0000">prueba.cxx: In function `int main(int, char**)':<BR>
prueba.cxx:12: error: ISO C++ forbids declaration of `ImageToVTKImageFilter'<BR>
with no type<BR>
prueba.cxx:12: error: template-id `ImageToVTKImageFilter<main(int,<BR>
char**)::ImageType>' used as a declarator<BR>
prueba.cxx:12: error: syntax error before `;' token<BR>
prueba.cxx:15: error: `ConnectorType' undeclared (first use this function)<BR>
prueba.cxx:15: error: (Each undeclared identifier is reported only once for<BR>
each function it appears in.)<BR>
prueba.cxx:15: error: syntax error before `::' token<BR>
prueba.cxx:18: error: `connector' undeclared (first use this function)<BR>
prueba.cxx:8: warning: unused parameter `int argc'<BR>
make: *** [prueba.o] Error 1</FONT><BR>
<BR>
I think I have all the libraries and includes right directed. May someone please give me a hand?<BR>
<BR>
Cheers,<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
David Macias Verde <<A HREF="mailto:david.maciasverde at gobiernodecanarias.org"><U>david.maciasverde at gobiernodecanarias.org</U></A>><BR>
Servicio de Física Médica - Hospital de Gran Canaria Dr. Negrín
</TD>
</TR>
</TABLE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<BR>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
--=-Jvh3F9F6ZikW8G3OgbMN--