STL operator::new conflict

From: William J Deninger (deninger@uiuc.edu)
Date: Mon Mar 09 1998 - 04:02:21 MET


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.   

// 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.  

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

William J Deninger

//_____________________________________
// example class header

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

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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:30 MET