[Insight-users] Help with compilation issue: expected class-name before '{' token

Martin Kavec kavec at messi.uku.fi
Tue Apr 25 21:36:42 EDT 2006


Hi,

I would very much appreciate if some could help me with compilation problem I 
have. Perhaps it's a bit late (2.30 am) and I am not able find out myself, 
where is the issue.

I use Gentoo linux, gcc-3.4.5 and ITK-2.6.0. I set up a project, where I 
define a class A (inheriting from itkObject) and class B (inheriting from A). 
In this configuration I am not able to compile a test file for B. If I 
implement everything in A, the code compiles.

Here is the compiler output:

c++ -ftemplate-depth-50 -g -I/opt/ITK_debug/Utilities/vxl/core 
-I/opt/ITK_debug/Utilities/vxl/vcl -I/opt/ITK-2.6.0/Utilities/vxl/core 
-I/opt/ITK-2.6.0/Utilities/vxl/vcl -I/opt/ITK-2.6.0/Utilities 
-I/opt/ITK_debug/Utilities -I/opt/ITK_debug/Utilities/gdcm 
-I/opt/ITK-2.6.0/Utilities/nifti/znzlib 
-I/opt/ITK-2.6.0/Utilities/nifti/niftilib -I/opt/ITK-2.6.0/Utilities/expat 
-I/opt/ITK_debug/Utilities/expat -I/opt/ITK_debug/Utilities/DICOMParser 
-I/opt/ITK-2.6.0/Utilities/DICOMParser -I/opt/ITK-2.6.0/Utilities/NrrdIO 
-I/opt/ITK-2.6.0/Utilities/MetaIO -I/opt/ITK-2.6.0/Code/SpatialObject 
-I/opt/ITK-2.6.0/Code/Numerics/NeuralNetworks 
-I/opt/ITK-2.6.0/Code/Numerics/Statistics -I/opt/ITK-2.6.0/Code/Numerics/FEM 
-I/opt/ITK-2.6.0/Code/IO -I/opt/ITK-2.6.0/Code/Numerics 
-I/opt/ITK-2.6.0/Code/Common -I/opt/ITK-2.6.0/Code/BasicFilters 
-I/opt/ITK-2.6.0/Code/Algorithms -I/opt/ITK_debug -ggdb -Wall -o 
CMakeFiles/itkTanimotoSpatialObjectSimilarityCoefficient.dir/itkTanimotoSpatialObjectSimilarityCoefficient.o 
-c /home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.cxx
In file included 
from /home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.cxx:21:
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:29: 
error: expected class-name before '{' token
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:34: 
error: `SpatialObjectSimilarityCoefficient' does not name a type
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:44: 
error: `Superclass' has not been declared
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:44: 
error: expected nested-name-specifier before "CoefficientType"
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:44: 
error: `CoefficientType' does not name a type
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:46: 
error: `Superclass' has not been declared
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:46: 
error: expected nested-name-specifier before "SpatialObjectType"
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:46: 
error: `SpatialObjectType' does not name a type
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:47: 
error: `Superclass' has not been declared
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:47: 
error: expected nested-name-specifier before "PixelType"
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:47: 
error: `PixelType' does not name a type
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:48: 
error: `Superclass' has not been declared
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:48: 
error: expected nested-name-specifier before "Pointer"
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:48: 
error: `Pointer' does not name a type
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:49: 
error: `Superclass' has not been declared
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:49: 
error: expected nested-name-specifier before "ConstPointer"
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:49: 
error: `ConstPointer' does not name a type
/home/kavec/Projects/itkSpatialObjectSimilarityCoefficient/itkTanimotoSpatialObjectSimilarityCoefficient.h:51: 
error: expected `,' or `...' before '*' token

I also attach the sources and CMakeList.txt.

Thanks in advance.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkTanimotoSpatialObjectSimilarityCoefficient.cxx
Type: text/x-c++src
Size: 2261 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20060426/642c38cf/itkTanimotoSpatialObjectSimilarityCoefficient.cxx
-------------- next part --------------
PROJECT( itkSpatialObjectSimilarityCoefficient )


FIND_PACKAGE(ITK)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR
            "Cannot build InsightApplications without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)

SET(CMAKE_VERBOSE_MAKEFILE ON)
ADD_DEFINITIONS(-ggdb -Wall)

INCLUDE_REGULAR_EXPRESSION(".*")

ADD_EXECUTABLE(itkDiceSpatialObjectSimilarityCoefficient
               itkDiceSpatialObjectSimilarityCoefficient.cxx )
TARGET_LINK_LIBRARIES(itkDiceSpatialObjectSimilarityCoefficient
                      ITKNumerics ITKStatistics ITKIO)

ADD_EXECUTABLE(itkTanimotoSpatialObjectSimilarityCoefficient 
               itkTanimotoSpatialObjectSimilarityCoefficient.cxx )
TARGET_LINK_LIBRARIES(itkTanimotoSpatialObjectSimilarityCoefficient ITKNumerics ITKStatistics ITKIO)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkSpatialObjectSimilarityCoefficient.txx
Type: text/x-c++src
Size: 1147 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20060426/642c38cf/itkSpatialObjectSimilarityCoefficient.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkTanimotoSpatialObjectSimilarityCoefficient.txx
Type: text/x-c++src
Size: 3242 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20060426/642c38cf/itkTanimotoSpatialObjectSimilarityCoefficient.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkTanimotoSpatialObjectSimilarityCoefficient.h
Type: text/x-c++hdr
Size: 3002 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20060426/642c38cf/itkTanimotoSpatialObjectSimilarityCoefficient.hpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkSpatialObjectSimilarityCoefficient.h
Type: text/x-c++hdr
Size: 2446 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20060426/642c38cf/itkSpatialObjectSimilarityCoefficient.hpp


More information about the Insight-users mailing list