[Insight-users] Need tutorial tu use Itk with VS2005

Michael Jackson mike.jackson at bluequartz.net
Tue Oct 13 10:09:44 EDT 2009


This has got to be the most common error that I see when moving from  
Linux/Unix/OS X to Windows and it can be very difficult to diagnose  
when you are new to Windows.

Essentially, the problem is that for better or worse, all compiled  
projects that link together on Windows using Visual Studio MUST be  
compiled EXACTLY the same way regarding the threading model and debug/ 
release and also the same version of Visual Studio (including Service  
Packs).

Ignoring warnings will only send you down a path of trying to debug  
something that is not fixable. Period. Here are some examples.

Say I use ITK in a project and I have it compiled in Release mode. Say  
I now compile my project in Debug mode in order to actually debug my  
code. VS will throw a warning about conflicting libraries and to use  
to the /NODEFAULTLIB link flag. DO NOT DO THIS. Instead, go back and  
recompile ITK in Debug mode and install that OVER TOP of the original  
Release version of ITK. Now, go back and do a "Rebuild" of your  
project. Link warning is now gone and you can now safely debug your  
project without any side effects**.

  This same thing can happen if one of your projects is compiled as a  
Single Threaded model and another is compiled as a Multi-threaded model.

   And also watch out for either statically or dyamically linking to  
the C/C++ runtimes. This will cause some of the same issues as above.

  The problem becomes even more of a pain if you mix-and-match Visual  
Studio versions. Then you have to worry about the whole "Re- 
distributable" package for your project and Side-by-Side assemblies.

   So the short answer is this: If you are using a bunch of 3rd party  
libraries in your project be sure to compile them all with the same  
parameters.

**Again, I would _love_ to see ITK do the same thing Qt does and  
decorate the debug libraries with _debug or _d or D or something so  
that I can have both the Debug and Release libraries installed in the  
same location AT THE SAME TIME. Currently, I have to "install" the  
debug libraries, then rebuild my large project to debug, then  
"install" the Release version, then rebuild my project to test out the  
performance. Kind of a pain. Qt's use of decorated libraries makes  
this transition relatively less painless.

Hope some of that helps.
_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio

On Oct 12, 2009, at 9:21 AM, Daanen Vincent wrote:

> Dear itk users
>
> I'm trying to use ITK (3.16.0) into an already existing application  
> based on
> MFC. The problems I have is that as soon as I have to link against  
> an ITK
> library, the linker fails which tons of errors about conflicts between
> msvcrt(d).lib and libcmt(d).lib.
>
> I searched over the internet and these proposal of solutions :
> - exclude and try to find the good librairies order (MSDN advices)
> - use /FORCE flag
> - recompile itk with different "Use MFC librairies" setting: I tried  
> "Use
> windows standard libraires" and "Use MFC in static lib" since in  
> linking
> against MFC static libraires
>
> But none of them work.
>
> So I need someone to tell me what I have to do/check to use Itk in a  
> "full
> of MFC'ies" project.
>
> Please help, I'm tired to waste my time :(
>
> V
>
> --------------------------------------------
> Vincent Daanen, PhD
> D&D Manager
>
> --------------------------------------------
> KOELIS
> 5, avenue du Grand Sablon 38700 La Tronche
> www.koelis.com  -  daanen at koelis.com
> Tel .+33(0) 476637588 Fax .+33(0) 476637592
> --------------------------------------------
>
> CONFIDENTIALITY This e-mail and any attachments are confidential and  
> may
> also be privileged. If you are not the named recipient, please  
> notify the
> sender immediately and do not disclose the contents to another  
> person, use
> it for any purpose, or store or copy the information in any medium.
>
> "Les problèmes ne peuvent être résolus par ceux dont l'horizon se  
> limite aux
> réalités quotidiennes,  mais par ceux qui rêvent de choses qui n'ont  
> jamais
> existé et qui se disent : Pourquoi Pas ?" (J-F Kennedy, 1963).
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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



More information about the Insight-users mailing list