Hi Bruno,<br><br>Was there any progress on this front? I'm interested in migrating my lab to VS2012 eventually so I will investigate later if the solution has not been found already.<br><br>Regards,<br><br clear="all">
<div>Ho Cheung<br>Research Assistant<br>Bio-Image Analytics Lab - University of Houston<br><a href="mailto:hocheung20@gmail.com" target="_blank">hocheung20@gmail.com</a><br>Cell: (775) 388-2368</div>
<br><br><div class="gmail_quote">On Mon, Feb 4, 2013 at 9:46 AM, Bruno Ronzani <span dir="ltr"><<a href="mailto:bruno.ronzani@oyez.fr" target="_blank">bruno.ronzani@oyez.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey back,<br>
<br>
I'm still stuck on it ! It's been days...<br>
<br>
Here is a sample code : <a href="http://codepad.org/jXtJdRnK" target="_blank">http://codepad.org/jXtJdRnK</a><br>
<br>
But look, this is from itksys/Configure.h ... why "#if 0" ?!<br>
<br>
Since there is no dll_export, i'm not surprised that ITK is always<br>
built statically :(<br>
<br>
/******/<br>
<br>
/* Setup the export macro. */<br>
#if 0<br>
# if defined(_WIN32) || defined(__CYGWIN__)<br>
# if defined(itksys_EXPORTS)<br>
# define itksys_EXPORT __declspec(dllexport)<br>
# else<br>
# define itksys_EXPORT __declspec(dllimport)<br>
# endif<br>
# elif __GNUC__ >= 4<br>
# define itksys_EXPORT __attribute__ ((visibility("default")))<br>
# else<br>
# define itksys_EXPORT<br>
# endif<br>
#else<br>
# define itksys_EXPORT<br>
#endif<br>
<br>
/*****/<br>
<br>
Thanks for you help,<br>
<br>
Bruno<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Mon, Feb 4, 2013 at 2:46 PM, Bruno Ronzani <<a href="mailto:bruno.ronzani@oyez.fr">bruno.ronzani@oyez.fr</a>> wrote:<br>
> I just tried to add the osgDB::fstream class to my project :<br>
><br>
> - copying both osgDB/fstream.h and osgDB/fstream.cpp to my project<br>
> source dir, adding them to my project.<br>
> - removing all the "DLL_EXPORT" macros, but keeping the namespaces<br>
><br>
> => compilation succeeds, without any link error.<br>
><br>
> If that can help...<br>
><br>
> Thanks again,<br>
><br>
> Bruno<br>
><br>
> On Mon, Feb 4, 2013 at 2:33 PM, Bruno Ronzani <<a href="mailto:bruno.ronzani@oyez.fr">bruno.ronzani@oyez.fr</a>> wrote:<br>
>> Hello Brad,<br>
>><br>
>> Thank you for your answer.<br>
>><br>
>> You are right, here is the osgDB/fstream header :<br>
>><br>
>> <a href="https://github.com/openscenegraph/osg/blob/master/include/osgDB/fstream" target="_blank">https://github.com/openscenegraph/osg/blob/master/include/osgDB/fstream</a><br>
>><br>
>> As you can see, osg cleanly redefines its own fstream, but that should<br>
>> not be a problem at all.<br>
>><br>
>> I've read several times this issue with this kind of answer:<br>
>><br>
>> "I have been using Visual Studio 2010 and fstreams and OSG DLLs with<br>
>> no issues at all. The only possibility is you are compiling with<br>
>> incompatible compiler options between OSG and your other library. All<br>
>> files must be compiled /MD(d) and of course compiled with Visual<br>
>> Studio 2010."<br>
>><br>
>> My guess is I haven't really compiled ITK with /MD, don't you think ?<br>
>><br>
>> If you want a very simple example, I can try to provide one.<br>
>><br>
>> Thanks again,<br>
>><br>
>> On Mon, Feb 4, 2013 at 1:56 PM, Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>> wrote:<br>
>>> Hello,<br>
>>><br>
>>> Are you using a CMake file to build your project?<br>
>>><br>
>>> Can you boil down this issue to a minimal example to reproduce this error?<br>
>>><br>
>>> 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.<br>
>>><br>
>>> Brad<br>
>>><br>
>>> On Feb 4, 2013, at 6:53 AM, Bruno Ronzani <<a href="mailto:bruno.ronzani@oyez.fr">bruno.ronzani@oyez.fr</a>> wrote:<br>
>>><br>
>>>> Hello everyone,<br>
>>>><br>
>>>> I am doing all I can to build ITK on VS2012, but I am experiencing a<br>
>>>> lot of trouble...<br>
>>>><br>
>>>> - I am using CMake.<br>
>>>> - If I choose to build "static" (build_shared unchecked) ITK,<br>
>>>> everything compiles fine.<br>
>>>> - if I choose to build "shared" (build_shared checked), everything<br>
>>>> compiles fine too. One ITKCommon-4.0.dll is created.<br>
>>>><br>
>>>> Now here the trouble...<br>
>>>><br>
>>>> When I try to compile a sample program with OpenSceneGraph, I have a<br>
>>>> bunch of link errors of type :<br>
>>>><br>
>>>> ITKMetaIO-4.0.lib(metaObject.obj) : error LNK2005: "public: __thiscall<br>
>>>> std::basic_ifstream<char,struct std::char_traits<char><br>
>>>>> ::basic_ifstream<char,struct std::char_traits<char> >(void)"<br>
>>>> (??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@XZ) already<br>
>>>> defined in osgDB.lib(osg92-osgDB.dll)<br>
>>>><br>
>>>> Apparently, this kind of errors appear when a static library is linked<br>
>>>> with a dynamic one...<br>
>>>> I've checked in my "shared" ITK solution project : most of the<br>
>>>> projects are still built in static mode.<br>
>>>> I tried to force the "Use MFC in a Shared DLL" but it doesn't change anything.<br>
>>>> If I force the Configuration Type to .dll, then I have a bunch of link<br>
>>>> errors, like :<br>
>>>><br>
>>>> unresolved external symbol __imp__RegCloseKey@4 referenced in function<br>
>>>> "public: static bool __cdecl<br>
>>>> itksys::SystemTools::DeleteRegistryValue(char const *,enum<br>
>>>> itksys::SystemTools::KeyWOW64)"<br>
>>>> (?DeleteRegistryValue@SystemTools@itksys@@SA_NPBDW4KeyWOW64@12@@Z)<br>
>>>><br>
>>>> Any idea ?<br>
>>>><br>
>>>> Thank you very much !<br>
>>>><br>
>>>> Cheers,<br>
>>>><br>
>>>> Bruno<br>
>>>> _______________________________________________<br>
>>>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>>><br>
>>>> Visit other Kitware open-source projects at<br>
>>>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>>><br>
>>>> Kitware offers ITK Training Courses, for more information visit:<br>
>>>> <a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br>
>>>><br>
>>>> Please keep messages on-topic and check the ITK FAQ at:<br>
>>>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>>>><br>
>>>> Follow this link to subscribe/unsubscribe:<br>
>>>> <a href="http://www.itk.org/mailman/listinfo/insight-developers" target="_blank">http://www.itk.org/mailman/listinfo/insight-developers</a><br>
>>><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-developers" target="_blank">http://www.itk.org/mailman/listinfo/insight-developers</a><br>
</div></div></blockquote></div><br>