[Insight-users] ISO C++ Error
Luis Ibanez
luis.ibanez at kitware.com
Mon Oct 16 19:55:07 EDT 2006
Hi Sonali,
You shouldn't add the .h and .txx files to your ADD_EXECUTABLE statement
in the CMakeLists.txt file.
You only need to add the .cxx files.
The .h and .txx should be brought in by the compiler as it encounters
their corresponding #include instructions in your .cxx files.
Regards,
Luis
=====================
Sonali Barua wrote:
> Hello,
>
> I am trying to build a ITK Graph library. All my files are either .h or
> .txx files. I had added the .h files of the .txx files in ADD_EXECUTABLE
> of my CMakeLists.txt file. When I run make after running CMake , these
> Errors occur:
>
> 100%] Building CXX object
> CMakeFiles/PrimMinimumSpanningTree.dir/PrimMinimumSpanningTree.o
> In file included from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/PrimMinimumSpanningTree.cxx:4:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkDefaultImageToGraphFunctor.h:
> In member function `virtual bool
> itk::DefaultImageToGraphFunctor<TInputImage,
> TOutputGraph>::IsPixelANode(typename
> itk::ImageToGraphFunctor<TInputImage, TOutputGraph>::IndexType)':
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkDefaultImageToGraphFunctor.h:159:
> error: `m_ExcludeBackground' was not declared in this scope
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkDefaultImageToGraphFunctor.h:160:
> error: `m_BackgroundValue' was not declared in this scope
> In file included from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/PrimMinimumSpanningTree.cxx:5:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:
> At global scope:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:51:
> error: ISO C++ forbids declaration of `InputEdgePointerType' with no type
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:51:
> error: ISO C++ forbids declaration of `InputEdgePointer' with no type
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:52:
> error: class definition may not be declared a friend
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:77:
> error: `CompareWeight' has not been declared
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:83:
> error: `vector' was not declared in this scope
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:83:
> error: template argument 2 is invalid
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:83:
> error: template argument 3 is invalid
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:83:
> error: expected unqualified-id before ',' token
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:120:
> error: `NodePriorityQueueType' does not name a type
> In file included from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.txx:9,
> from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:133,
> from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/PrimMinimumSpanningTree.cxx:5:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:4:1:
> unterminated #ifndef
> In file included from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:133,
> from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/PrimMinimumSpanningTree.cxx:5:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.txx:13:
> error: expected unqualified-id before "namespace"
> In file included from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/PrimMinimumSpanningTree.cxx:5:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkPrimMinimumSpanningTreeGraphFilter.h:4:1:
> unterminated #ifndef
> In file included from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/PrimMinimumSpanningTree.cxx:6:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.h:64:
> error: expected `;' before "m_Input"
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.h:65:
> error: expected `;' before "m_Output"
> In file included from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.h:71,
> from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/PrimMinimumSpanningTree.cxx:6:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:16:
> error: redefinition of `itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::SimpleImageToGraphFunctor()'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.h:56:
> error: `itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::SimpleImageToGraphFunctor()' previously declared here
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:
> In constructor `itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::SimpleImageToGraphFunctor()':
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:19:
> error: `m_BackgroundValue' was not declared in this scope
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:19:
> error: `PixelType' has not been declared
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:20:
> error: `m_ExcludeBackground' was not declared in this scope
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:
> At global scope:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:31:
> error: no `void itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::SetInput(const TInputImage*)' member function declared in
> class `itk::itk::SimpleImageToGraphFunctor<TInputImage, TOutputGraph>'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:31:
> error: template definition of non-template `void
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::SetInput(const TInputImage*)'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:43:
> error: no `void itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::SetInput(unsigned int, const TInputImage*)' member
> function declared in class
> `itk::itk::SimpleImageToGraphFunctor<TInputImage, TOutputGraph>'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:43:
> error: template definition of non-template `void
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::SetInput(unsigned int, const TInputImage*)'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:56:
> error: no `const typename
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::InputImageType*
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::GetInput()' member function declared in class
> `itk::itk::SimpleImageToGraphFunctor<TInputImage, TOutputGraph>'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:56:
> error: template definition of non-template `const typename
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::InputImageType*
> itk::itk::SimpleImageToGraphFunctor<TInputImage, TOutputGraph>::GetInput()'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:73:
> error: no `const typename
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::InputImageType*
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::GetInput(unsigned int)' member function declared in class
> `itk::itk::SimpleImageToGraphFunctor<TInputImage, TOutputGraph>'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:73:
> error: template definition of non-template `const typename
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::InputImageType*
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::GetInput(unsigned int)'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:82:
> error: redefinition of `void
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::PrintSelf(std::ostream&, itk::Indent) const'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.h:59:
> error: `void itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::PrintSelf(std::ostream&, itk::Indent) const' previously
> declared here
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:
> In member function `void
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::PrintSelf(std::ostream&, itk::Indent) const':
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:84:
> error: `m_ExcludeBackground' was not declared in this scope
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:87:
> error: `m_BackgroundValue' was not declared in this scope
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:
> At global scope:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:97:
> error: no `bool itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::IsPixelNode(typename
> itk::DefaultImageToGraphFunctor<TInputImage, TOutputGraph>::IndexType)'
> member function declared in class
> `itk::itk::SimpleImageToGraphFunctor<TInputImage, TOutputGraph>'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:97:
> error: template definition of non-template `bool
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::IsPixelNode(typename
> itk::DefaultImageToGraphFunctor<TInputImage, TOutputGraph>::IndexType)'
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:
> In member function `bool
> itk::itk::SimpleImageToGraphFunctor<TInputImage,
> TOutputGraph>::IsPixelNode(typename
> itk::DefaultImageToGraphFunctor<TInputImage, TOutputGraph>::IndexType)':
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:98:
> error: `m_Input' was not declared in this scope
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:
> At global scope:
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:110:
> error: expected constructor, destructor, or type conversion before
> "SimpleImageToGraphFunctor"
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/itkSimpleImageToGraphFunctor.txx:125:
> error: expected constructor, destructor, or type conversion before
> "SimpleImageToGraphFunctor"
> In file included from
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/IO/itkImageFileReader.txx:22,
> from
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/IO/itkImageFileReader.h:171,
> from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/PrimMinimumSpanningTree.cxx:10:
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/IO/itkImageIOFactory.h:43:
> error: `itk::ImageIOBase' has not been declared
> In file included from
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkRGBPixel.h:153,
> from
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/IO/itkConvertPixelBuffer.txx:21,
> from
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/IO/itkConvertPixelBuffer.h:119,
> from
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/IO/itkImageFileReader.txx:23,
> from
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/IO/itkImageFileReader.h:171,
> from
> /home/sbarua/GraphAlgorithms/itkGraphTrial/ExamplePipeline4/PrimMinimumSpanningTree.cxx:10:
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkNumericTraitsRGBPixel.h:31:
> error: specialization of `template<class T> class itk::NumericTraits' in
> different namespace
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkNumericTraits.h:41:
> error: from definition of `template<class T> class itk::NumericTraits'
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkNumericTraitsRGBPixel.h:33:
> error: ISO C++ forbids declaration of `RGBPixel' with no type
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkNumericTraitsRGBPixel.h:33:
> error: expected `;' before '<' token
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkNumericTraitsRGBPixel.h:34:
> error: ISO C++ forbids declaration of `RGBPixel' with no type
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkNumericTraitsRGBPixel.h:34:
> error: expected `;' before '<' token
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkNumericTraitsRGBPixel.h:35:
> error: ISO C++ forbids declaration of `RGBPixel' with no type
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkNumericTraitsRGBPixel.h:35:
> error: expected `;' before '<' token
> /graphics/apps/graphics/itk/InsightToolkit-2.8.1/Code/Common/itkNumericTraitsRGBPixel.h:36:
> error: ISO C++ forbids declaration of `RGBPixel' with no type
>
> Could you provide me with some suggestions as to what might have caused
> these types of errors. I know another user had the same problem but she
> needed to set her FLTK path. I am not using FLTK, just ITK. My other
> programs that use ITK work fine so I don't know if its an environmental
> variable issue. I have attached my CMakeList file as well with this email.
>
> Any suggestions will be highly appreciated.
>
> Sincerely,
>
> Sonali Barua.
>
> On 10/1/06, *Luis Ibanez* <luis.ibanez at kitware.com
> <mailto:luis.ibanez at kitware.com>> wrote:
>
>
>
> Hi Sonali,
>
> Please post the *EXACT* error messages that you are getting.
>
> Do you get these errors when building ITK ?
>
> or when building your own application ?
>
>
>
> Chances are that you are forgetting to include the header
> files that correspond to those types.
>
> Regards,
>
>
> Luis
>
>
> ----------------------
> Sonali Barua wrote:
> > Hello,
> >
> > I am getting alot of ISO C++ Errors stating that it cannot
> recognise the
> > Type of the variable. When I checked the code it didn't look like
> > anything was wrong with it. Where could the problem possibly be?
> Is it a
> > compiler or flag issue?
> >
> > Sincerely,
> >
> > Sonali Barua.
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org <mailto:Insight-users at itk.org>
> > http://www.itk.org/mailman/listinfo/insight-users
>
>
>
More information about the Insight-users
mailing list