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

Darren Weber darren.weber.lists at gmail.com
Thu Oct 29 14:56:11 EDT 2009


Hi Olivier,

I put your download files into ~/tmp and then modified your command line
compile process to the following (note that I'm on OSX 10.5 sdk):

/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.5.sdk
-mfix-and-continue -fvisibility-inlines-hidden -mmacosx-version-min=10.5
-gdwarf-2 -iquote/opt/local/include/InsightToolkit/Common  --verbose  -c
test.mm -o test.o

This worked for me at the terminal command prompt (under bash).  Note that I
removed all the precompiled headers and other stuff from the Xcode command
line.  Maybe you should run a full project clean?  Also note that I've
compiled against the MacPorts version of ITK @ 3.16.0, which sits in
/opt/local/include/InsightToolkit/ (but that should be equivalent to your
local install).



[ dweber at XXX ~/tmp ]$ /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.5.sdk
-mfix-and-continue -fvisibility-inlines-hidden -mmacosx-version-min=10.5
-gdwarf-2 -iquote/opt/local/include/InsightToolkit/Common  --verbose  -c
test.mm -o test.o
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc_42/gcc_42-5574~1/src/configure
--disable-checking --enable-werror --prefix=/usr --mandir=/usr/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
--build=i686-apple-darwin9 --with-gxx-include-dir=/usr/include/c++/4.0.0
--host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5574)
 /Developer/usr/bin/../libexec/gcc/i686-apple-darwin9/4.2.1/cc1objplus
-quiet -v -imultilib x86_64 -iprefix
/Developer/usr/bin/../lib/gcc/i686-apple-darwin9/4.2.1/ -D__DYNAMIC__
-isysroot /Developer/SDKs/MacOSX10.5.sdk
-iquote/opt/local/include/InsightToolkit/Common test.mm -fPIC -quiet
-dumpbase test.mm -mpascal-strings -mfix-and-continue
-mmacosx-version-min=10.5 -m64 -mtune=core2 -auxbase-strip test.o -gdwarf-2
-O0 -Wno-trigraphs -Wreturn-type -Wunused-variable -version
-fmessage-length=0 -fasm-blocks -fvisibility-inlines-hidden
-D__private_extern__=extern -o - |
 /Developer/usr/bin/../libexec/gcc/i686-apple-darwin9/4.2.1/as -arch x86_64
-force_cpusubtype_ALL -o test.o
ignoring nonexistent directory
"/Developer/SDKs/MacOSX10.5.sdk/usr/local/include"
ignoring nonexistent directory
"/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.2.1/../../../../i686-apple-darwin9/include"
#include "..." search starts here:
 /opt/local/include/InsightToolkit/Common
#include <...> search starts here:
 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0
 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/i686-apple-darwin9/x86_64
 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/backward
 /Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.2.1/include
 /Developer/SDKs/MacOSX10.5.sdk/usr/include
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks (framework
directory)
 /Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks (framework directory)
End of search list.
GNU Objective-C++ version 4.2.1 (Apple Inc. build 5574) (i686-apple-darwin9)
    compiled by GNU C version 4.2.1 (Apple Inc. build 5574).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: fe31312d751b818d0b05f1519c5a5714

[ dweber at XXX ~/tmp ]$ ll
total 128K
-rw-r--r--+ 1 dweber staff  212 2009-10-29 11:36 test.h
-rw-r--r--+ 1 dweber staff  295 2009-10-29 11:36 test.mm
-rw-r--r--+ 1 dweber staff 118K 2009-10-29 11:45 test.o
















On Thu, Oct 29, 2009 at 6:25 AM, Olivier Saut <saut.olivier at orange.fr>wrote:

> Dear Darren,
>
> sorry for the late answer, I was on a  trip for work. I appreciate very
> much your help.
> I am using ITK in C++ and was hoping to use Cocoa to build a user friendly
> interface around it.
> I have attached my mm file to this mail.
>
> Thanks again!
>
>
> The verbose output for the compilation on my system is
> /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
> --verbose  -c /Users/saut/Desktop/Untitled/test.mm -o
> /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Objects-normal/x86_64/test.o
> Using built-in specs.
> Target: i686-apple-darwin10
> Configured with: /var/tmp/gcc/gcc-5646.1~2/src/configure --disable-checking
> --enable-werror --prefix=/usr --mandir=/share/man
> --enable-languages=c,objc,c++,obj-c++
> --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
> --build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
> --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10
> --target=i686-apple-darwin10
> Thread model: posix
> gcc version 4.2.1 (Apple Inc. build 5646) (dot 1)
>  /Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/cc1objplus
> -quiet -v
> -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
> -F/Users/saut/Desktop/Untitled/build/Debug
> -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
> -imultilib x86_64 -iprefix
> /Developer/usr/bin/../lib/gcc/i686-apple-darwin10/4.2.1/ -D__DYNAMIC__
> -isysroot /Developer/SDKs/MacOSX10.6.sdk -iquote
> /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-generated-files.hmap
> -iquote
> /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-project-headers.hmap
> -iquote/Users/saut/thrill/include/InsightToolkit/Common -include
> /var/folders/Wa/WaB1Wzw+HaCPXA71ALf6+++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Untitled_Prefix-csugzkpcvxzatqfcqgrxlfvlcabr/Untitled_Prefix.pch
> /Users/saut/Desktop/Untitled/test.mm -fPIC -quiet -dumpbase test.mm-mpascal-strings -mfix-and-continue -mmacosx-version-min=10.6 -m64
> -mtune=core2 -auxbase-strip
> /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Objects-normal/x86_64/test.o
> -gdwarf-2 -O0 -Wno-trigraphs -Wreturn-type -Wunused-variable -version
> -fmessage-length=0 -fasm-blocks -fvisibility-inlines-hidden
> -D__private_extern__=extern -o - |
>  /Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/as -arch
> x86_64 -force_cpusubtype_ALL -o
> /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Objects-normal/x86_64/test.o
> ignoring nonexistent directory
> "/Developer/SDKs/MacOSX10.6.sdk/usr/local/include"
> ignoring nonexistent directory
> "/Developer/SDKs/MacOSX10.6.sdk/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../../i686-apple-darwin10/include"
> ignoring nonexistent directory
> "/Users/saut/Desktop/Untitled/build/Debug/include"
> ignoring nonexistent directory
> "/Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/DerivedSources/x86_64"
> ignoring nonexistent directory
> "/Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/DerivedSources"
> #include "..." search starts here:
>  /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-generated-files.hmap
> (headermap)
>  /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-project-headers.hmap
> (headermap)
>  /Users/saut/thrill/include/InsightToolkit/Common
> #include <...> search starts here:
>  /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-own-target-headers.hmap
> (headermap)
>  /Users/saut/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-all-target-headers.hmap
> (headermap)
>  /Users/saut/Desktop/Untitled/build/Debug (framework directory)
>  /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1
>
>  /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64
>  /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/backward
>
>  /Developer/SDKs/MacOSX10.6.sdk/usr/lib/gcc/i686-apple-darwin10/4.2.1/include
>  /Developer/SDKs/MacOSX10.6.sdk/usr/include
>  /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks (framework
> directory)
>  /Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks (framework directory)
> End of search list.
> GNU Objective-C++ version 4.2.1 (Apple Inc. build 5646) (dot 1)
> (i686-apple-darwin10)
>        compiled by GNU C version 4.2.1 (Apple Inc. build 5646) (dot 1).
> GGC heuristics: --param ggc-min-expand=150 --param ggc-min-heapsize=131072
> Compiler executable checksum: 49e3775622e3f2330b547374d96176ff
>
> 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
>
>
> Le 27 oct. 2009 à 21:29, Darren Weber a écrit :
>
>
>
>> Try to copy the gcc command line and run it manually, with the addition of
>> some more verbose output.  Try to identify where it really gets the
>> libraries from.  Could you send me a copy of your .mm file, I might try to
>> compile it on my system (Leopard server).
>>
>>
>>
>> On Tue, Oct 27, 2009 at 7:07 AM, Olivier Saut <saut.olivier at orange.fr>
>> wrote:
>>
>> Le 26 oct. 2009 à 22:27, Darren Weber a écrit :
>>
>>
>> Did you try changing the search path to the ITK root:
>>
>> /Users/saut/thrill/include/InsightToolkit/
>>
>>
>>
>> Yes, unfortunately it does not change the result. I have also tried
>> including recursively all the headers from the include root directory.
>>
>> Thanks,
>>
>>                     - Olivier
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091029/ba4acf32/attachment-0001.htm>


More information about the Insight-users mailing list