[ITK] [ITK-users] Problems with writing filter using Xcode

Vikash Gupta vikash.gupta at inria.fr
Fri Jul 3 10:10:42 EDT 2015


Hi Matt, 
I did the manual instantiation in the .h file. Should I send the files... will you be able to have a look ? 

Thanks 
Vikash 
----- Original Message -----

> From: "Matt McCormick" <matt.mccormick at kitware.com>
> To: "Vikash Gupta" <vikash.gupta at inria.fr>
> Cc: "Sean McBride" <sean at rogue-research.com>, "insight-users at itk org"
> <insight-users at itk.org>
> Sent: Friday, July 3, 2015 4:22:24 AM
> Subject: Re: [ITK-users] Problems with writing filter using Xcode

> Hi Vikash,

> It depends on the content of your project files, but it does sound like it
> was a templated class. A templated class needs to be either defined in a
> header or it needs to be explicitly instantiated over all the types it will
> be used with in a .cxx file to avoid link errors. ITK usually puts the
> declaration in a .h files, then #include's the definition in a .hxx if
> manual instantiation is not used [1].

> HTH,
> Matt

> [1]
> https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImage.h#L297-L299

> On Fri, Jul 3, 2015 at 5:59 AM, Vikash Gupta < vikash.gupta at inria.fr > wrote:

> > Hey Matt,
> 
> > Here is the extract from the CMakeLists.txt
> 

> > ADD_EXECUTABLE(testMapping testMapping.cxx)
> 

> > TARGET_LINK_LIBRARIES(testMapping ${ITK_LIBRARIES})
> 

> > And the filter MapLR2HR is called from TestMapping.cxx. It used to work on
> > a
> > Linux system.
> 

> > Here is a stackexchange answer I found
> 

> > http://stackoverflow.com/questions/20230412/undefined-symbols-for-architecture-x86-64-shared-util-library-build-with-cmake
> 

> > So when I defined the function in the .h file itself the error disappeared.
> > However, why this should happen for one particular function and not all the
> > others. It should be consistent. So I am not able to figure that out.
> 

> > Thanks for all the help
> 

> > Vikash
> 

> > > From: "Matt McCormick" < matt.mccormick at kitware.com >
> > 
> 
> > > To: "Vikash Gupta" < vikash.gupta at inria.fr >
> > 
> 
> > > Cc: "Sean McBride" < sean at rogue-research.com >, "insight-users at itk org" <
> > > insight-users at itk.org >
> > 
> 
> > > Sent: Friday, July 3, 2015 2:41:49 AM
> > 
> 

> > > Subject: Re: [ITK-users] Problems with writing filter using Xcode
> > 
> 

> > > Hi Vikash,
> > 
> 

> > > What does your CMakeLists.txt look like? Are all executables created
> > > added
> > > in
> > > the CMakeLists.txt file with the add_executable and target_link_libraries
> > > command?
> > 
> 

> > > Thanks,
> > 
> 
> > > Matt
> > 
> 

> > > On Fri, Jul 3, 2015 at 3:51 AM, Vikash Gupta < vikash.gupta at inria.fr >
> > > wrote:
> > 
> 

> > > > Hey guys,
> > > 
> > 
> 
> > > > So, I moved to a different IDE (Eclipse). I am still getting similar
> > > > error.
> > > 
> > 
> 

> > > > Here is the error
> > > 
> > 
> 

> > > > Undefined symbols for architecture x86_64:
> > > 
> > 
> 
> > > > "itk::MapLR2HRFilter<itk::Image<float, 3u>
> > > > >::SetTransform(itk::SmartPointer<itk::AffineTransform<double, 3u> >)",
> > > > referenced from:
> > > 
> > 
> 
> > > > _main in testMapping.o
> > > 
> > 
> 
> > > > ld: symbol(s) not found for architecture x86_64
> > > 
> > 
> 
> > > > clang: error: linker command failed with exit code 1 (use -v to see
> > > > invocation)
> > > 
> > 
> 

> > > > After some googling i figured its a problem with OS X. I wonder if
> > > > anyone
> > > > knows how to fix it.
> > > 
> > 
> 

> > > > Thanks
> > > 
> > 
> 
> > > > Vikash
> > > 
> > 
> 

> > > > ----- Original Message -----
> > > 
> > 
> 
> > > > > From: "Vikash Gupta" < vikash.gupta at inria.fr >
> > > 
> > 
> 
> > > > > To: "Sean McBride" < sean at rogue-research.com >
> > > 
> > 
> 
> > > > > Cc: "insight-users at itk org" < insight-users at itk.org >
> > > 
> > 
> 
> > > > > Sent: Thursday, July 2, 2015 1:19:21 PM
> > > 
> > 
> 
> > > > > Subject: Re: [ITK-users] Problems with writing filter using Xcode
> > > 
> > 
> 
> > > > >
> > > 
> > 
> 
> > > > > Ok I am updating it ...
> > > 
> > 
> 
> > > > >
> > > 
> > 
> 
> > > > > ----- Original Message -----
> > > 
> > 
> 
> > > > > > From: "Vikash Gupta" < vikash.gupta at inria.fr >
> > > 
> > 
> 
> > > > > > To: "Sean McBride" < sean at rogue-research.com >
> > > 
> > 
> 
> > > > > > Cc: "insight-users at itk org" < insight-users at itk.org >
> > > 
> > 
> 
> > > > > > Sent: Thursday, July 2, 2015 1:16:44 PM
> > > 
> > 
> 
> > > > > > Subject: Re: [ITK-users] Problems with writing filter using Xcode
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > > Or maybe I am doing something wrong.. Here is what I am doing step
> > > > > > by
> > > > > > step
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > > 1. Build ITK as I would normally considering a UNIX machine
> > > 
> > 
> 
> > > > > > 2. Use a text editor to make the CMakeLists.txt and arrange my
> > > > > > directories
> > > 
> > 
> 
> > > > > > 3. use ccmake -GXcode to generate my xcode project
> > > 
> > 
> 
> > > > > > 4. Open the Xcode project and write the filters I need.
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > > Vikash
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > > ----- Original Message -----
> > > 
> > 
> 
> > > > > > > From: "Vikash Gupta" < vikash.gupta at inria.fr >
> > > 
> > 
> 
> > > > > > > To: "Sean McBride" < sean at rogue-research.com >
> > > 
> > 
> 
> > > > > > > Cc: "insight-users at itk org" < insight-users at itk.org >
> > > 
> > 
> 
> > > > > > > Sent: Thursday, July 2, 2015 1:09:00 PM
> > > 
> > 
> 
> > > > > > > Subject: Re: [ITK-users] Problems with writing filter using Xcode
> > > 
> > 
> 
> > > > > > >
> > > 
> > 
> 
> > > > > > > Hi Sean,
> > > 
> > 
> 
> > > > > > > Yes I was using Xcode 6.xx But then I read on stackexchange that
> > > > > > > there
> > > > > > > is
> > > 
> > 
> 
> > > > > > > some bug with the xcode 6.xx so rolled back to 5.xx . Also I was
> > > 
> > 
> 
> > > > > > > wondering
> > > 
> > 
> 
> > > > > > > if the .txx is a good extension for the counterpart to the .h
> > > > > > > file.
> > > 
> > 
> 
> > > > > > >
> > > 
> > 
> 
> > > > > > > Vikash
> > > 
> > 
> 
> > > > > > >
> > > 
> > 
> 
> > > > > > > ----- Original Message -----
> > > 
> > 
> 
> > > > > > > > From: "Sean McBride" < sean at rogue-research.com >
> > > 
> > 
> 
> > > > > > > > To: "Vikash Gupta" < vikash.gupta at inria.fr >,
> > > > > > > > "insight-users at itk
> > > > > > > > org"
> > > 
> > 
> 
> > > > > > > > < insight-users at itk.org >
> > > 
> > 
> 
> > > > > > > > Sent: Thursday, July 2, 2015 1:05:04 PM
> > > 
> > 
> 
> > > > > > > > Subject: Re: [ITK-users] Problems with writing filter using
> > > > > > > > Xcode
> > > 
> > 
> 
> > > > > > > >
> > > 
> > 
> 
> > > > > > > > On Thu, 2 Jul 2015 21:18:41 +0200, Vikash Gupta said:
> > > 
> > 
> 
> > > > > > > >
> > > 
> > 
> 
> > > > > > > > >I am using Mac OS X 10.10.3 and Xcode 5.1.1
> > > 
> > 
> 
> > > > > > > >
> > > 
> > 
> 
> > > > > > > > Maybe not the cause of your problem, but note that that's not a
> > > > > > > > valid
> > > 
> > 
> 
> > > > > > > > combination. OS X 10.10.x requires Xcode 6.x (I forget exactly
> > > > > > > > which).
> > > 
> > 
> 
> > > > > > > >
> > > 
> > 
> 
> > > > > > > > Cheers,
> > > 
> > 
> 
> > > > > > > >
> > > 
> > 
> 
> > > > > > > > --
> > > 
> > 
> 
> > > > > > > > ____________________________________________________________
> > > 
> > 
> 
> > > > > > > > Sean McBride, B. Eng sean at rogue-research.com
> > > 
> > 
> 
> > > > > > > > Rogue Research www.rogue-research.com
> > > 
> > 
> 
> > > > > > > > Mac Software Developer Montréal, Québec, Canada
> > > 
> > 
> 
> > > > > > > >
> > > 
> > 
> 
> > > > > > > >
> > > 
> > 
> 
> > > > > > > >
> > > 
> > 
> 
> > > > > > > _____________________________________
> > > 
> > 
> 
> > > > > > > Powered by www.kitware.com
> > > 
> > 
> 
> > > > > > >
> > > 
> > 
> 
> > > > > > > Visit other Kitware open-source projects at
> > > 
> > 
> 
> > > > > > > http://www.kitware.com/opensource/opensource.html
> > > 
> > 
> 
> > > > > > >
> > > 
> > 
> 
> > > > > > > Kitware offers ITK Training Courses, for more information visit:
> > > 
> > 
> 
> > > > > > > http://www.kitware.com/products/protraining.php
> > > 
> > 
> 
> > > > > > >
> > > 
> > 
> 
> > > > > > > Please keep messages on-topic and check the ITK FAQ at:
> > > 
> > 
> 
> > > > > > > http://www.itk.org/Wiki/ITK_FAQ
> > > 
> > 
> 
> > > > > > >
> > > 
> > 
> 
> > > > > > > Follow this link to subscribe/unsubscribe:
> > > 
> > 
> 
> > > > > > > http://public.kitware.com/mailman/listinfo/insight-users
> > > 
> > 
> 
> > > > > > >
> > > 
> > 
> 
> > > > > > _____________________________________
> > > 
> > 
> 
> > > > > > Powered by www.kitware.com
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > > Visit other Kitware open-source projects at
> > > 
> > 
> 
> > > > > > http://www.kitware.com/opensource/opensource.html
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > > Kitware offers ITK Training Courses, for more information visit:
> > > 
> > 
> 
> > > > > > http://www.kitware.com/products/protraining.php
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > > Please keep messages on-topic and check the ITK FAQ at:
> > > 
> > 
> 
> > > > > > http://www.itk.org/Wiki/ITK_FAQ
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > > Follow this link to subscribe/unsubscribe:
> > > 
> > 
> 
> > > > > > http://public.kitware.com/mailman/listinfo/insight-users
> > > 
> > 
> 
> > > > > >
> > > 
> > 
> 
> > > > > _____________________________________
> > > 
> > 
> 
> > > > > Powered by www.kitware.com
> > > 
> > 
> 
> > > > >
> > > 
> > 
> 
> > > > > Visit other Kitware open-source projects at
> > > 
> > 
> 
> > > > > http://www.kitware.com/opensource/opensource.html
> > > 
> > 
> 
> > > > >
> > > 
> > 
> 
> > > > > Kitware offers ITK Training Courses, for more information visit:
> > > 
> > 
> 
> > > > > http://www.kitware.com/products/protraining.php
> > > 
> > 
> 
> > > > >
> > > 
> > 
> 
> > > > > Please keep messages on-topic and check the ITK FAQ at:
> > > 
> > 
> 
> > > > > http://www.itk.org/Wiki/ITK_FAQ
> > > 
> > 
> 
> > > > >
> > > 
> > 
> 
> > > > > Follow this link to subscribe/unsubscribe:
> > > 
> > 
> 
> > > > > http://public.kitware.com/mailman/listinfo/insight-users
> > > 
> > 
> 
> > > > >
> > > 
> > 
> 
> > > > _____________________________________
> > > 
> > 
> 
> > > > Powered by www.kitware.com
> > > 
> > 
> 

> > > > Visit other Kitware open-source projects at
> > > 
> > 
> 
> > > > http://www.kitware.com/opensource/opensource.html
> > > 
> > 
> 

> > > > Kitware offers ITK Training Courses, for more information visit:
> > > 
> > 
> 
> > > > http://www.kitware.com/products/protraining.php
> > > 
> > 
> 

> > > > Please keep messages on-topic and check the ITK FAQ at:
> > > 
> > 
> 
> > > > http://www.itk.org/Wiki/ITK_FAQ
> > > 
> > 
> 

> > > > Follow this link to subscribe/unsubscribe:
> > > 
> > 
> 
> > > > http://public.kitware.com/mailman/listinfo/insight-users
> > > 
> > 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150703/d340a65e/attachment-0001.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list