[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 &quot;itkImage.h&quot;<BR>
#include &quot;itkImageFileReader.h&quot;<BR>
#include &quot;itkImageToVTKImageFilter.h&quot;<BR>
<BR>
#include &quot;vtkImageViewer.h&quot;<BR>
#include &quot;vtkRenderWindowInteractor.h&quot;<BR>
<BR>
int main( int argc, char **argv ) {<BR>
<BR>
&nbsp; typedef itk::Image &lt;unsigned short,2&gt;&nbsp;&nbsp;&nbsp; 	&nbsp;&nbsp;&nbsp;&nbsp; ImageType;<BR>
&nbsp; typedef itk::ImageFileReader &lt;ImageType&gt; 	&nbsp;&nbsp;&nbsp;&nbsp; ReaderType;<BR>
&nbsp; typedef itk::ImageToVTKImageFilter &lt;ImageType&gt;&nbsp;&nbsp; ConnectorType;<BR>
<BR>
&nbsp; ReaderType::Pointer reader = ReaderType::New();<BR>
&nbsp; ConnectorType::Pointer connector = ConnectorType::New();<BR>
 <BR>
&nbsp; reader-&gt;SetFileName( argv[1] );<BR>
&nbsp; connector-&gt;SetInput( reader-&gt;GetOutput() );<BR>
<BR>
&nbsp; vtkImageViewer * viewer = vtkImageViewer::New();<BR>
&nbsp; <BR>
&nbsp; vtkRenderWindowInteractor * renderWindowInteractor = vtkRenderWindowInteractor::New();<BR>
<BR>
&nbsp; viewer-&gt;SetupInteractor( renderWindowInteractor );<BR>
&nbsp; viewer-&gt;SetInput( connector-&gt;GetOutput() );<BR>
<BR>
&nbsp; viewer-&gt;Render();<BR>
&nbsp; viewer-&gt;SetColorWindow( 255 );<BR>
&nbsp; viewer-&gt;SetColorLevel( 128 );<BR>
&nbsp; renderWindowInteractor-&gt;Start();<BR>
&nbsp;&nbsp;&nbsp; <BR>
&nbsp; 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>
&nbsp;&nbsp; with no type<BR>
prueba.cxx:12: error: template-id `ImageToVTKImageFilter&lt;main(int,<BR>
&nbsp;&nbsp; char**)::ImageType&gt;' 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>
&nbsp;&nbsp; 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 &lt;<A HREF="mailto:david.maciasverde at gobiernodecanarias.org"><U>david.maciasverde at gobiernodecanarias.org</U></A>&gt;<BR>
Servicio de F&#237;sica M&#233;dica - Hospital de Gran Canaria Dr. Negr&#237;n
</TD>
</TR>
</TABLE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<BR>
</TD>
</TR>
</TABLE>

</BODY>
</HTML>

--=-Jvh3F9F6ZikW8G3OgbMN--