<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi,<br>
    <br>
    It looks like you're encountering two problems:<br>
    <br>
    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:<br>
    <br>
    TARGET_LINK_LIBRARIES(${targetname} ITKAlgorithms ITKCommon ITKIO)<br>
    <br>
    Then just add ITKNumerics to the end of that.<br>
    <br>
    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).<br>
    <br>
    Regards,<br>
    Stu<br>
    <br>
    On 30/10/2010 19:56, <a class="moz-txt-link-abbreviated" href="mailto:fariba_yoo@yahoo.co.uk">fariba_yoo@yahoo.co.uk</a> wrote:
    <blockquote cite="mid:43763.18929.qm@web25008.mail.ukl.yahoo.com"
      type="cite">
      <style type="text/css"><!-- DIV {margin:0px;} --></style>
      <div style="font-family: tahoma,new york,times,serif; font-size:
        12pt;">
        <div>Hello dear davoud,<br>
          <br>
          I made Cmake.txt just like the one you told me.<br>
          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,<br>
          here I paste the whole output:<br>
          1&gt;------ Build started: Project: ImageRegistration2,
          Configuration: Debug Win32 ------<br>
          1&gt;Compiling...<br>
          1&gt;ImageRegistration2.cxx<br>
          1&gt;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'<br>
          1&gt;        C:\Program Files (x86)\Microsoft Visual Studio
          9.0\VC\include\xutility(2550) : see declaration of 'std::copy'<br>
          1&gt;        d:\itk\code\io\itkImageFileReader.txx(361) :
          while compiling class template member function 'void
          itk::ImageFileReader&lt;TOutputImage&gt;::GenerateData(void)'<br>
          1&gt;        with<br>
          1&gt;        [<br>
          1&gt;            TOutputImage=FixedImageType<br>
          1&gt;        ]<br>
          1&gt;       
          ..\..\ITK\ImageRegistration2Src\ImageRegistration2.cxx(255) :
          see reference to class template instantiation
          'itk::ImageFileReader&lt;TOutputImage&gt;' being compiled<br>
          1&gt;        with<br>
          1&gt;        [<br>
          1&gt;            TOutputImage=FixedImageType<br>
          1&gt;        ]<br>
          1&gt;Compiling manifest to resources...<br>
          1&gt;Microsoft (R) Windows (R) Resource Compiler Version
          6.0.5724.0<br>
          1&gt;Copyright (C) Microsoft Corporation.  All rights
          reserved.<br>
          1&gt;Linking...<br>
          1&gt;   Creating library
          D:\ITK-Binary\ImageRegistration2Bin\Debug\ImageRegistration2.lib
          and object
          D:\ITK-Binary\ImageRegistration2Bin\Debug\ImageRegistration2.exp<br>
          1&gt;ImageRegistration2.obj : error LNK2019: unresolved
          external symbol "protected: __thiscall
          itk::GradientDescentOptimizer::GradientDescentOptimizer(void)"
          (??0GradientDescentOptimizer@itk@@IAE@XZ) referenced in
          function "public: static class itk::SmartPointer&lt;class
          itk::GradientDescentOptimizer&gt; __cdecl
          itk::GradientDescentOptimizer::New(void)"
(?New@GradientDescentOptimizer@itk@@SA?AV?$SmartPointer@VGradientDescentOptimizer@itk@@@2@XZ)<br>
          1&gt;ImageRegistration2.obj : error LNK2001: unresolved
          external symbol "protected: virtual void __thiscall
          itk::CostFunction::PrintSelf(class
          std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt;
          &gt; &amp;,class itk::Indent)const "
(?PrintSelf@CostFunction@itk@@MBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@VIndent@2@@Z)<br>
          1&gt;D:\ITK-Binary\ImageRegistration2Bin\Debug\ImageRegistration2.exe
          : fatal error LNK1120: 2 unresolved externals<br>
          1&gt;Build log was saved at
<a class="moz-txt-link-rfc2396E" href="file://d:\ITK-Binary\ImageRegistration2Bin\ImageRegistration2.dir\Debug\BuildLog.htm">"file://d:\ITK-Binary\ImageRegistration2Bin\ImageRegistration2.dir\Debug\BuildLog.htm"</a><br>
          1&gt;ImageRegistration2 - 3 error(s), 1 warning(s)<br>
          ========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0
          skipped ==========<br>
          <br>
          <br>
          but here I think somewhere in the program I should give my
          image address, but where and when I had to give the address?<br>
          <br>
          <br>
          Kind Regards,<br>
          Fariba<br>
        </div>
        <div style="font-family: tahoma,new york,times,serif; font-size:
          12pt;"><br>
          <div style="font-family: arial,helvetica,sans-serif;
            font-size: 13px;"><font size="2" face="Tahoma">
              <hr size="1"><b><span style="font-weight: bold;"></span></b></font><br>
            End of Insight-users Digest, Vol 78, Issue 39<br>
            *********************************************<br>
          </div>
        </div>
      </div>
      <br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_____________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Kitware offers ITK Training Courses, for more information visit:
<a class="moz-txt-link-freetext" href="http://www.kitware.com/products/protraining.html">http://www.kitware.com/products/protraining.html</a>

Please keep messages on-topic and check the ITK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a>
</pre>
    </blockquote>
  </body>
</html>