[Insight-developers] ITK Shared Build with VS2012

Bradley Lowekamp blowekamp at mail.nih.gov
Mon Feb 4 07:56:36 EST 2013


Hello,

Are you using a CMake file to build your project?

Can you boil down this issue to a minimal example to reproduce this error?

What seems odd to me is that it sounds like osg92-osgDB.dll is export the std::basic_ifstream. So this may not even be an ITK issue.

Brad

On Feb 4, 2013, at 6:53 AM, Bruno Ronzani <bruno.ronzani at oyez.fr> wrote:

> Hello everyone,
> 
> I am doing all I can to build ITK on VS2012, but I am experiencing a
> lot of trouble...
> 
> - I am using CMake.
> - If I choose to build "static" (build_shared unchecked) ITK,
> everything compiles fine.
> - if I choose to build "shared" (build_shared checked), everything
> compiles fine too. One ITKCommon-4.0.dll is created.
> 
> Now here the trouble...
> 
> When I try to compile a sample program with OpenSceneGraph, I have a
> bunch of link errors of type :
> 
> ITKMetaIO-4.0.lib(metaObject.obj) : error LNK2005: "public: __thiscall
> std::basic_ifstream<char,struct std::char_traits<char>
>> ::basic_ifstream<char,struct std::char_traits<char> >(void)"
> (??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QAE at XZ) already
> defined in osgDB.lib(osg92-osgDB.dll)
> 
> Apparently, this kind of errors appear when a static library is linked
> with a dynamic one...
> I've checked in my "shared" ITK solution project : most of the
> projects are still built in static mode.
> I tried to force the "Use MFC in a Shared DLL" but it doesn't change anything.
> If I force the Configuration Type to .dll, then I have a bunch of link
> errors, like :
> 
> unresolved external symbol __imp__RegCloseKey at 4 referenced in function
> "public: static bool __cdecl
> itksys::SystemTools::DeleteRegistryValue(char const *,enum
> itksys::SystemTools::KeyWOW64)"
> (?DeleteRegistryValue at SystemTools@itksys@@SA_NPBDW4KeyWOW64 at 12@@Z)
> 
> Any idea ?
> 
> Thank you very much !
> 
> Cheers,
> 
> Bruno
> _______________________________________________
> 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://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://www.itk.org/mailman/listinfo/insight-developers



More information about the Insight-developers mailing list