[Insight-users] Insight-users Digest, Vol 78, Issue 39
Stuart Golodetz
itk at gxstudios.net
Sat Oct 30 16:16:28 EDT 2010
Hi,
It looks like you're encountering two problems:
1) (The more important one) You're not linking in the ITKNumerics
library, so you're getting linker errors about GradientDescentOptimizer
and CostFunction. To fix this, I suspect (although I haven't tested it)
that you need to find the line in your CMakeLists.txt file which looks
something like this:
TARGET_LINK_LIBRARIES(${targetname} ITKAlgorithms ITKCommon ITKIO)
Then just add ITKNumerics to the end of that.
2) (The less important one) Microsoft has decided to warn you about
using the Standard Library on security grounds -- this is somewhat
understandable, but annoying (the replacement functions they want you to
use aren't as portable as the standard ones). Most people I know seem to
either ignore the warnings (they're an example of what people in
comp.lang.c++ call "Microsoft silly warnings") or disable them by
defining _SCL_SECURE_NO_WARNINGS (personally I recommend the latter,
because if you've decided to ignore spurious warnings then you don't
want them obscuring more important ones that you really need to deal with).
Regards,
Stu
On 30/10/2010 19:56, fariba_yoo at yahoo.co.uk wrote:
> Hello dear davoud,
>
> I made Cmake.txt just like the one you told me.
> and then I copied ImageRegistration2.cxx and and the newly made
> Cmake.txt to a new folder, then I created another folder for binary
> one, then using Cmake I configured and generated it, the I opened
> binary folder and ran imageRegistration2.sln, then built the solution
> in visual studio but encountered an error,
> here I paste the whole output:
> 1>------ Build started: Project: ImageRegistration2, Configuration:
> Debug Win32 ------
> 1>Compiling...
> 1>ImageRegistration2.cxx
> 1>d:\itk\code\io\itkImageFileReader.txx(439) : warning C4996:
> 'std::copy': Function call with parameters that may be unsafe - this
> call relies on the caller to check that the passed values are correct.
> To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See
> documentation on how to use Visual C++ 'Checked Iterators'
> 1> C:\Program Files (x86)\Microsoft Visual Studio
> 9.0\VC\include\xutility(2550) : see declaration of 'std::copy'
> 1> d:\itk\code\io\itkImageFileReader.txx(361) : while compiling
> class template member function 'void
> itk::ImageFileReader<TOutputImage>::GenerateData(void)'
> 1> with
> 1> [
> 1> TOutputImage=FixedImageType
> 1> ]
> 1> ..\..\ITK\ImageRegistration2Src\ImageRegistration2.cxx(255)
> : see reference to class template instantiation
> 'itk::ImageFileReader<TOutputImage>' being compiled
> 1> with
> 1> [
> 1> TOutputImage=FixedImageType
> 1> ]
> 1>Compiling manifest to resources...
> 1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
> 1>Copyright (C) Microsoft Corporation. All rights reserved.
> 1>Linking...
> 1> Creating library
> D:\ITK-Binary\ImageRegistration2Bin\Debug\ImageRegistration2.lib and
> object D:\ITK-Binary\ImageRegistration2Bin\Debug\ImageRegistration2.exp
> 1>ImageRegistration2.obj : error LNK2019: unresolved external symbol
> "protected: __thiscall
> itk::GradientDescentOptimizer::GradientDescentOptimizer(void)"
> (??0GradientDescentOptimizer at itk@@IAE at XZ) referenced in function
> "public: static class itk::SmartPointer<class
> itk::GradientDescentOptimizer> __cdecl
> itk::GradientDescentOptimizer::New(void)"
> (?New at GradientDescentOptimizer@itk@@SA?AV?$SmartPointer at VGradientDescentOptimizer@itk@@@2 at XZ)
> 1>ImageRegistration2.obj : error LNK2001: unresolved external symbol
> "protected: virtual void __thiscall itk::CostFunction::PrintSelf(class
> std::basic_ostream<char,struct std::char_traits<char> > &,class
> itk::Indent)const "
> (?PrintSelf at CostFunction@itk@@MBEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z)
> 1>D:\ITK-Binary\ImageRegistration2Bin\Debug\ImageRegistration2.exe :
> fatal error LNK1120: 2 unresolved externals
> 1>Build log was saved at
> "file://d:\ITK-Binary\ImageRegistration2Bin\ImageRegistration2.dir\Debug\BuildLog.htm"
> 1>ImageRegistration2 - 3 error(s), 1 warning(s)
> ========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped
> ==========
>
>
> but here I think somewhere in the program I should give my image
> address, but where and when I had to give the address?
>
>
> Kind Regards,
> Fariba
>
> ------------------------------------------------------------------------
> **
> End of Insight-users Digest, Vol 78, Issue 39
> *********************************************
>
>
> _____________________________________
> 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.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101030/592a1bc6/attachment.htm>
More information about the Insight-users
mailing list