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

Darren Weber darren.weber.lists at gmail.com
Mon Oct 26 17:27:42 EDT 2009


Did you try changing the search path to the ITK root:

/Users/saut/thrill/include/InsightToolkit/


Looks like the -x objective-c++ option does the right thing.  From `man gcc`

"    355        -ObjC
     356        -ObjC++
     357            These are similar in effect to -x objective-c and -x
objective-c++, but affect only the choice of
     358            compiler for files already identified as source files.
(APPLE ONLY)
"


On Mon, Oct 26, 2009 at 1:29 PM, Olivier Saut <saut.olivier at orange.fr>wrote:

>
> Le 26 oct. 2009 à 20:57, Sean McBride a écrit :
>
>
>
>> On 10/26/09 12:49 PM, Darren Weber said:
>>
>>  Was the ITK lib built with the cocoa option for the render engine?  (The
>>> alternatives are x11 and carbon.)
>>>
>>
>> You're thinking of VTK, not ITK. :)
>>
>> Olivier, in your test project, can you include other C++ headers (not
>> ITK ones) without compiler errors?
>>
>
>
> Yes. For instance starting from a new project (with User Header Search Path
> minimally set to $HOME/thrill/include/InsightToolkit/Common)  the following
> code :
> ---
> //  test.mm
> #import "test.h"
> #include <iostream>
> #include <vector>
>
> // Compiles and run without the following include
> #include "itkSmartPointer.h"
>
> @implementation test
>
> - (id) init {
>    NSLog(@"test");
>
>    std::vector<double> vect;
>    vect.push_back(0.0);
>    std::cout << "test" << std::endl;
>    return self;
> }
>
> @end
> ---
> compiles and run when I comment out #include "itkSmartPointer.h".
> With the ITK include, I obtain the following error :
> /Users/saut/thrill/include/InsightToolkit/Common/itkSmartPointer.h:129:
> error: function definition does not declare parameters
>
> The complete transcript is
> Build Untitled of project Untitled with configuration Debug
>
> CompileC
> build/Untitled.build/Debug/Untitled.build/Objects-normal/x86_64/test.o
> test.mm normal x86_64 objective-c++ com.apple.compilers.gcc.4_2
> cd /Users/saut/Desktop/Untitled
>
> 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 -Wreturn-type
> -Wunused-variable -isysroot /Developer/SDKs/MacOSX10.6.sdk
> -mfix-and-continue -fvisibility-inlines-hidden -mmacosx-version-min=10.6
> -gdwarf-2 -iquote
> /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-generated-files.hmap
> -I/Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-own-target-headers.hmap
> -I/Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-all-target-headers.hmap
> -iquote
> /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-project-headers.hmap
> -F/Users/saut/Desktop/Untitled/build/Debug
> -iquote/Users/saut/thrill/include/InsightToolkit/Common
> -I/Users/saut/Desktop/Untitled/build/Debug/include
> -I/Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/DerivedSources/x86_64
> -I/Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/DerivedSources
> -include
> /var/folders/Wa/WaB1Wzw+HaCPXA71ALf6+++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Untitled_Prefix-csugzkpcvxzatqfcqgrxlfvlcabr/Untitled_Prefix.pch
> -c /Users/saut/Desktop/Untitled/test.mm -o
> /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Objects-normal/x86_64/test.o
>
> In file included from /Users/saut/Desktop/Untitled/test.mm:8:
> /Users/saut/thrill/include/InsightToolkit/Common/itkSmartPointer.h:129:
> error: function definition does not declare parameters
>
>
>
> Thanks!
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091026/412dc4ef/attachment.htm>


More information about the Insight-users mailing list