[Insight-users] Using ITK in a Cocoa App (+Xcode)

Olivier Saut saut.olivier at orange.fr
Wed Oct 14 14:06:12 EDT 2009


Hi all,

sorry if it is a frequent question but I have not found any working  
solution to my problem: I am trying (without success so far) to use  
ITK in a Cocoa app  on Snow Leopard (Xcode 3.2) . Project file was  
generated from Xcode.

I have  set the filetype of the file containing the ITK calls to  
Objective-C++ (sourcecode.cpp.objcpp), Header and Library Search Paths  
are set to find ITK files. However I still have the following errors  
just by including itkImage. (I can use ITK within a command line app  
in C++.)

Anyone knows what I am doing wrong?


Thanks!

-- Source file ---
#import "Segmenter.hpp"

#ifdef __cplusplus
// (found on http://www.nabble.com/Re:-itk-vtk-and-cocoa-p20230764.html)
// Define undefined constant to avoid warnings.
#define ITK_TEMPLATE_CXX 0
#define ITK_TEMPLATE_TYPE 0
#include<itkImage.h>
#endif

@implementation Segmenter
- (id) init {
  self=[super init];
  if(self != nil) {

  }
  return self;
}

@end
-- End of Source file --

-- Error Log --
Build CSeg of project CSeg with configuration Debug

CompileC build/CSeg.build/Debug/CSeg.build/Objects-normal/x86_64/ 
Segmenter.o Segmenter.mm normal x86_64 objective-c++  
com.apple.compilers.gcc.4_2
cd /Users/saut/Dropbox/CSeg
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch x86_64 -fmessage- 
length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -pg - 
Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/ 
MacOSX10.6.sdk -mfix-and-continue -fobjc-gc -fvisibility-inlines- 
hidden -mmacosx-version-min=10.6 -gdwarf-2 -fopenmp -iquote /Users/ 
saut/Dropbox/CSeg/build/CSeg.build/Debug/CSeg.build/CSeg-generated- 
files.hmap -I/Users/saut/Dropbox/CSeg/build/CSeg.build/Debug/ 
CSeg.build/CSeg-own-target-headers.hmap -I/Users/saut/Dropbox/CSeg/ 
build/CSeg.build/Debug/CSeg.build/CSeg-all-target-headers.hmap - 
iquote /Users/saut/Dropbox/CSeg/build/CSeg.build/Debug/CSeg.build/CSeg- 
project-headers.hmap -F/Users/saut/Dropbox/CSeg/build/Debug -I/Users/ 
saut/Dropbox/CSeg/build/Debug/include -I/Users/saut/thrill/include/ 
InsightToolkit -I/Users/saut/thrill/include/InsightToolkit/Algorithms - 
I/Users/saut/thrill/include/InsightToolkit/BasicFilters -I/Users/saut/ 
thrill/include/InsightToolkit/Common -I/Users/saut/thrill/include/ 
InsightToolkit/gdcm -I/Users/saut/thrill/include/InsightToolkit/IO -I/ 
Users/saut/thrill/include/InsightToolkit/Numerics -I/Users/saut/thrill/ 
include/InsightToolkit/SpatialObject -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities -I/Users/saut/thrill/include/InsightToolkit/ 
gdcm/Dicts -I/Users/saut/thrill/include/InsightToolkit/gdcm/src -I/ 
Users/saut/thrill/include/InsightToolkit/Numerics/FEM -I/Users/saut/ 
thrill/include/InsightToolkit/Numerics/NeuralNetworks -I/Users/saut/ 
thrill/include/InsightToolkit/Numerics/Statistics -I/Users/saut/thrill/ 
include/InsightToolkit/Utilities/expat -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/itkExtHdrs -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/itkpng -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/itksys -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/itktiff -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/itkzlib -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/MetaIO -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/NrrdIO -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/itksys/ios -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/itksys/stl -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl/core -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl/v3p -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl/vcl -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl/core/vnl -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl/v3p/netlib -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl/vcl/borland55 -I/Users/saut/thrill/ 
include/InsightToolkit/Utilities/vxl/vcl/borland56 -I/Users/saut/ 
thrill/include/InsightToolkit/Utilities/vxl/vcl/egcs -I/Users/saut/ 
thrill/include/InsightToolkit/Utilities/vxl/vcl/emulation -I/Users/ 
saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/gcc -I/Users/saut/ 
thrill/include/InsightToolkit/Utilities/vxl/vcl/gcc-295 -I/Users/saut/ 
thrill/include/InsightToolkit/Utilities/vxl/vcl/gcc-libstdcxx-v3 -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/generic -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/iso -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/mwerks -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/sgi -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/stlport -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/sunpro -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/vcl_sys -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/win32-vc60 - 
I/Users/saut/thrill/include/InsightToolkit/Utilities/vxl/vcl/win32- 
vc70 -I/Users/saut/thrill/include/InsightToolkit/Utilities/vxl/core/ 
vnl/algo -I/Users/saut/thrill/include/InsightToolkit/Utilities/vxl/v3p/ 
netlib/blas -I/Users/saut/thrill/include/InsightToolkit/Utilities/vxl/ 
v3p/netlib/datapac -I/Users/saut/thrill/include/InsightToolkit/ 
Utilities/vxl/v3p/netlib/eispack -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl/v3p/netlib/lapack -I/Users/saut/thrill/ 
include/InsightToolkit/Utilities/vxl/v3p/netlib/laso -I/Users/saut/ 
thrill/include/InsightToolkit/Utilities/vxl/v3p/netlib/linalg -I/Users/ 
saut/thrill/include/InsightToolkit/Utilities/vxl/v3p/netlib/linpack -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/v3p/netlib/ 
mathews -I/Users/saut/thrill/include/InsightToolkit/Utilities/vxl/v3p/ 
netlib/minpack -I/Users/saut/thrill/include/InsightToolkit/Utilities/ 
vxl/v3p/netlib/napack -I/Users/saut/thrill/include/InsightToolkit/ 
Utilities/vxl/v3p/netlib/opt -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl/v3p/netlib/sparse -I/Users/saut/thrill/ 
include/InsightToolkit/Utilities/vxl/v3p/netlib/temperton -I/Users/ 
saut/thrill/include/InsightToolkit/Utilities/vxl/v3p/netlib/toms -I/ 
Users/saut/thrill/include/InsightToolkit/Utilities/vxl/v3p/netlib/ 
lapack/complex16 -I/Users/saut/thrill/include/InsightToolkit/Utilities/ 
vxl/v3p/netlib/lapack/double -I/Users/saut/thrill/include/ 
InsightToolkit/Utilities/vxl/v3p/netlib/lapack/single -I/Users/saut/ 
thrill/include/InsightToolkit/Utilities/vxl/v3p/netlib/lapack/util -I/ 
Users/saut/Dropbox/CSeg/build/CSeg.build/Debug/CSeg.build/ 
DerivedSources/x86_64 -I/Users/saut/Dropbox/CSeg/build/CSeg.build/ 
Debug/CSeg.build/DerivedSources -include /var/folders/Wa/WaB1Wzw 
+HaCPXA71ALf6+++++TI/-Caches-/com.apple.Xcode.501/ 
SharedPrecompiledHeaders/CSeg_Prefix-bdswsgxfpnuwmmchklxbfrubchhw/ 
CSeg_Prefix.pch -c /Users/saut/Dropbox/CSeg/Segmenter.mm -o /Users/ 
saut/Dropbox/CSeg/build/CSeg.build/Debug/CSeg.build/Objects-normal/ 
x86_64/Segmenter.o

In file included from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkLightObject.h:20,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkObject.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkDataObject.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkImageBase.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkImage.h:20,
               from /Users/saut/Dropbox/CSeg/Segmenter.mm:16:
/Users/saut/thrill/include/InsightToolkit/Common/itkSmartPointer.h: 
129: error: expected ';' before '(' token
/Users/saut/thrill/include/InsightToolkit/Common/itkSmartPointer.h: 
136: error: expected `;' before 'private'
/Users/saut/thrill/include/InsightToolkit/Common/itkSmartPointer.h: 
153: error: expected constructor, destructor, or type conversion  
before '&' token
In file included from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkTimeStamp.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkLightObject.h:21,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkObject.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkDataObject.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkImageBase.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkImage.h:20,
               from /Users/saut/Dropbox/CSeg/Segmenter.mm:16:
/Users/saut/thrill/include/InsightToolkit/Common/itkMacro.h:533:  
error: expected class-name before '{' token
In file included from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkMacro.h:589,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkTimeStamp.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkLightObject.h:21,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkObject.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkDataObject.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkImageBase.h:23,
               from /Users/saut/thrill/include/InsightToolkit/Common/ 
itkImage.h:20,
               from /Users/saut/Dropbox/CSeg/Segmenter.mm:16:
/Users/saut/thrill/include/InsightToolkit/Common/itkExceptionObject.h: 
55: error: expected class-name before '{' token
/Users/saut/thrill/include/InsightToolkit/Common/itkExceptionObject.h: 
57: error: 'exception' in namespace 'std' does not name a type
/Users/saut/thrill/include/InsightToolkit/Common/itkExceptionObject.h: 
64: error: expected unqualified-id before '&' token
/Users/saut/thrill/include/InsightToolkit/Common/itkExceptionObject.h: 
64: error: expected ',' or '...' before '&' token
/Users/saut/thrill/include/InsightToolkit/Common/itkExceptionObject.h: 
66: error: 'itk::ExceptionObject::ExceptionObject()' cannot be  
overloaded
---


Thanks a lot,

						       	                	- Olivier




More information about the Insight-users mailing list