H
Herman.Schultz
Hi,
I am trying to use C++ iostream in Darwin (apple opensource streaming
server) source code.
Here is what I did:
1. Add these in the file
#include <iostream>
using namespace std;
2. Add ' cout << "Hello world" << endl; ' in the code.
But the problem is I get these compile errors about 'new' and
'delete'. It seems like Darwin source overload "new" and "delete" but
iostream does not like it. Can you please tell me how to fix it?
.../CommonUtilitiesLib/MyAssert.h:34: warning: 'class AssertLogger' has
virtual functions but non-virtual destructor
.../CommonUtilitiesLib/SDPUtils.h: In member function 'Bool16
SDPContainer::HasLineType(char)':
.../CommonUtilitiesLib/SDPUtils.h:92: warning: array subscript has type
'char'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
At global scope:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
84: error: declaration of 'void* operator new(size_t) throw
(std::bad_alloc)' throws different exceptions
.../CommonUtilitiesLib/OSMemory.h:139: error: from previous declaration
'void* operator new(size_t)'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
85: error: declaration of 'void* operator new [](size_t) throw
(std::bad_alloc)' throws different exceptions
.../CommonUtilitiesLib/OSMemory.h:140: error: from previous declaration
'void* operator new [](size_t)'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
86: error: declaration of 'void operator delete(void*) throw ()'
throws different exceptions
.../CommonUtilitiesLib/OSMemory.h:142: error: from previous declaration
'void operator delete(void*)'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
87: error: declaration of 'void operator delete [](void*) throw ()'
throws different exceptions
.../CommonUtilitiesLib/OSMemory.h:143: error: from previous declaration
'void operator delete [](void*)'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
In function 'void* operator new(size_t, void*)':
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
94: error: redefinition of 'void* operator new(size_t, void*)'
.../CommonUtilitiesLib/OSMemory.h:125: error: 'void* operator
new(size_t, void*)' previously defined here
I am trying to use C++ iostream in Darwin (apple opensource streaming
server) source code.
Here is what I did:
1. Add these in the file
#include <iostream>
using namespace std;
2. Add ' cout << "Hello world" << endl; ' in the code.
But the problem is I get these compile errors about 'new' and
'delete'. It seems like Darwin source overload "new" and "delete" but
iostream does not like it. Can you please tell me how to fix it?
.../CommonUtilitiesLib/MyAssert.h:34: warning: 'class AssertLogger' has
virtual functions but non-virtual destructor
.../CommonUtilitiesLib/SDPUtils.h: In member function 'Bool16
SDPContainer::HasLineType(char)':
.../CommonUtilitiesLib/SDPUtils.h:92: warning: array subscript has type
'char'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
At global scope:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
84: error: declaration of 'void* operator new(size_t) throw
(std::bad_alloc)' throws different exceptions
.../CommonUtilitiesLib/OSMemory.h:139: error: from previous declaration
'void* operator new(size_t)'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
85: error: declaration of 'void* operator new [](size_t) throw
(std::bad_alloc)' throws different exceptions
.../CommonUtilitiesLib/OSMemory.h:140: error: from previous declaration
'void* operator new [](size_t)'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
86: error: declaration of 'void operator delete(void*) throw ()'
throws different exceptions
.../CommonUtilitiesLib/OSMemory.h:142: error: from previous declaration
'void operator delete(void*)'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
87: error: declaration of 'void operator delete [](void*) throw ()'
throws different exceptions
.../CommonUtilitiesLib/OSMemory.h:143: error: from previous declaration
'void operator delete [](void*)'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
In function 'void* operator new(size_t, void*)':
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new:
94: error: redefinition of 'void* operator new(size_t, void*)'
.../CommonUtilitiesLib/OSMemory.h:125: error: 'void* operator
new(size_t, void*)' previously defined here