[Insight-developers] ITK Shared Build with VS2012

Bruno Ronzani bruno.ronzani at oyez.fr
Mon Feb 4 06:53:38 EST 2013


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


More information about the Insight-developers mailing list