Trying to use iostream in an open source project

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top