STL operator::new conflict

William J Deninger (deninger@uiuc.edu)
Sun, 8 Mar 1998 21:02:21 -0600


This is a multi-part message in MIME format.

------=_NextPart_000_0009_01BD4AD5.7C633D90
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,

I'm experiencing a linking problem when compiling root source code and =
the Standard Template Library (STL) deque. Apparently the operator::new =
in NEW_NewDelete.cpp and the operator::new in the STL memory.h both =
exists in global namespaces. Removal of NEW_NewDelete.cpp from the =
project doesn't solve the problem because the STL operator::new causes =
ROOT to crash when creating a TCanvas. =20

// linking error
"void * __cdecl operator new(unsigned int,void *)" (??2@YAPAXIPAX@Z) =
already defined in rootDoc.obj

Is there a way of employing namespaces to illiminate this linking error? =
And if so, how would I approach this problem? I'm not that familiar with =
namespaces. Background: root version 1.03/09. compiling by MS v5.0 =
visual C++, platform WinNT 4.0 w/sp 3. =20

Thanks again for all your help, past, present and future!

William J Deninger

//_____________________________________
// example class header

#include <deque>
class CRootDoc=20
{
protected: // create from serialization only
CRootDoc();
public:
std::deque<int> mydeque;
};

//______________________________________
// implementation file
CRootDoc::CRootDoc()
{
mydeque.push_back(1);
}

------=_NextPart_000_0009_01BD4AD5.7C633D90
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">

Hello,
 
I'm experiencing a linking problem = when=20 compiling root source code and the Standard Template Library (STL) = deque. =20 Apparently the operator::new in NEW_NewDelete.cpp and the operator::new = in the=20 STL memory.h both exists in global namespaces.  Removal of=20 NEW_NewDelete.cpp from the project doesn't solve the problem because the = STL=20 operator::new causes ROOT to crash when creating a TCanvas.  =20
 
// linking  error
"void * __cdecl operator = new(unsigned=20 int,void *)" (??2@YAPAXIPAX@Z) already defined in = rootDoc.obj
 
Is there a way of employing = namespaces to=20 illiminate this linking error? And if so, how would I approach this = problem? I'm=20 not that familiar with namespaces.  Background: root=20 version 1.03/09.  compiling by MS v5.0 visual C++, platform WinNT = 4.0 w/sp=20 3. 
 
Thanks again for all your help, = past, present=20 and future!
 
William J Deninger
 
//_________________= ____________________
// example class header
 
#include <deque>
class CRootDoc
{
protected: // create from serialization=20 only
     CRootDoc();
public:
    = std::deque<int>=20 mydeque;
};
 
//________________= ______________________
// implementation file
CRootDoc::CRootDoc()
{
   =20 mydeque.push_back(1);
}
------=_NextPart_000_0009_01BD4AD5.7C633D90--