Hi,

This seems to be the same / related to an issue raised some time ago with 
VS2010.

When I build VirtualPlanetBuilder with VS2010 I get errors complaining about 
duplicate definitions of the stream destructors (cant remember the details of 
hand). The same code works without issue on non-windows platforms and all other 
VS compilers tried.

As I don't have time to look into the issue I simply force the link to complete 
with multiply defined symbols.


A quick search through my local OSG-users archive found the thread + message 
included bellow. Do a search through the archives around this topic and you 
should find all the details.

Cheers,

Brad



Re: [osg-users] OT: VS2010 LNK2005 problem related to ostringstream

Ok, I have localized the problem.

For example, the class osgDB::fstream:

class OSGDB_EXPORT fstream : public std::fstream
{

};

which just inherits from std:.fstream causes the symbols of std::fstream to be 
exposed into osgDB.dll

This effectively means that It might cause problems for people linking against 
osgDB.dll later on.
Same goes for inheriting from std::string, std::ostringstream etc.

This must obviously be a bug, a very serious one in VS2010.
We had a class derived from std::ostringstream, which exposed the symbols in 
the vtable for the class:

namespace ns
{
class Notify : public std::ostringstream
{
};
}

Using depends.exe to analyze the dll-file gives:

const ns::Notify::`vftable'{for `std::basic_ostringstream<char,struct 
std::char_traits<char>,class std::allocator<char> >'}

My issue was reported to the msdn forum. Their first take was: Oh you use 
CMake, thats not our product :-)
But in later threads, they tried to reproduce the problem without luck...
So if you manage to reproduce this in a small example, go ahead and post it. We 
must make them aware of this problem.

http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/191de00a-53c9-4bd9-9cb6-e844eb224ca2

/Anders




From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Vincent 
Bourdier
Sent: Wednesday, 27 April 2011 11:47 PM
To: osg user
Subject: Re: [osg-users] osgDB ifstream / ofstream conflict

Hi,

Sorry to insist but I would appreciate any advices about this issue. Maybe I'm 
the only one who encountered it, but the patch I did is not so... "clean" to my 
mind...

Thanks.

Regards,
    Vincent.

Le 21/04/2011 14:50, Vincent Bourdier a écrit :
Hi all,

I just found a fix after some tests, but it is not a fix I am proud of.
I just added the close() method in osgDB/fstream implementation, so there is no 
conflict because my fstream implementation uses osgDB/fstream and not 
osgDB/fstream AND std::fstream.

I will continue to investigate to be sure to understand why this occurs, but 
any advices or explanations are welcome.
If my fix is accepted this could be a submission for OSG, eventually...

Thanks.

Regards,
    Vincent.

Le 20/04/2011 14:54, Vincent Bourdier a écrit :
Hi Mourad

Thanks for your answer but I already checked that. TsLib_MDdNET2010 is a static 
lib but linked with /MD(d), like my application...

Vincent.

Le 20/04/2011 11:50, Mourad Boufarguine a écrit :
Hi Vincent,
On Mon, Apr 4, 2011 at 4:36 PM, Vincent Bourdier 
<vincent.bourd...@gmail.com<mailto:vincent.bourd...@gmail.com>> wrote:
2>TsLib_MDdNET2010.lib(IwPoly.obj) : error LNK2005: "public: void __thiscall 
std::basic_ifstream<char,struct std::char_traits<char> >::close(void)" 
(?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined 
in osgDBd.lib(osg65-osgDBd.dll)
2>TsLib_MDdNET2010.lib(IwBrepData.obj) : error LNK2005: "public: void 
__thiscall std::basic_ifstream<char,struct std::char_traits<char> 
>::close(void)" (?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ) 
already defined in osgDBd.lib(osg65-osgDBd.dll)

It seems like a static/dynamic c++ runtime conflict. Check if osg and 
TsLib_MDdNET2010 are linked against the same type of c++ runtime (both with 
/MTd flag or both with /MDd flag)

Mourad



DISCLAIMER:---------------------------------------------------------------------------
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--------------------------------------------------------------------------------------

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to