I just tried to add the osgDB::fstream class to my project : - copying both osgDB/fstream.h and osgDB/fstream.cpp to my project source dir, adding them to my project. - removing all the "DLL_EXPORT" macros, but keeping the namespaces
=> compilation succeeds, without any link error. If that can help... Thanks again, Bruno On Mon, Feb 4, 2013 at 2:33 PM, Bruno Ronzani <[email protected]> wrote: > Hello Brad, > > Thank you for your answer. > > You are right, here is the osgDB/fstream header : > > https://github.com/openscenegraph/osg/blob/master/include/osgDB/fstream > > As you can see, osg cleanly redefines its own fstream, but that should > not be a problem at all. > > I've read several times this issue with this kind of answer: > > "I have been using Visual Studio 2010 and fstreams and OSG DLLs with > no issues at all. The only possibility is you are compiling with > incompatible compiler options between OSG and your other library. All > files must be compiled /MD(d) and of course compiled with Visual > Studio 2010." > > My guess is I haven't really compiled ITK with /MD, don't you think ? > > If you want a very simple example, I can try to provide one. > > Thanks again, > > On Mon, Feb 4, 2013 at 1:56 PM, Bradley Lowekamp <[email protected]> > wrote: >> 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 <[email protected]> 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@DU?$char_traits@D@std@@@std@@QAE@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@4 referenced in function >>> "public: static bool __cdecl >>> itksys::SystemTools::DeleteRegistryValue(char const *,enum >>> itksys::SystemTools::KeyWOW64)" >>> (?DeleteRegistryValue@SystemTools@itksys@@SA_NPBDW4KeyWOW64@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 >> _______________________________________________ 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
