?
Solved

`operator new' takes type `size_t' as first parameter

Posted on 2003-03-17
6
Medium Priority
?
567 Views
Last Modified: 2007-12-19
I'm compiling C++ code with m68k-elf-g++ compiler. I'm getting the following error messages:


include/new:32: `operator new' takes type `size_t' as first parameter
include/new:33: `operator new' takes type `size_t' as first parameter
include/new:36: `operator new' takes type `size_t' as first parameter
include/new:37: `operator new' takes type `size_t' as first parameter
include/new:42: `operator new' takes type `size_t' as first parameter
include/new:43: `operator new' takes type `size_t' as first parameter


The code in include/new looks like this:

#pragma interface "new"
#include <stddef.h>
#include <exception>

extern "C++" {

#if 0
namespace std {
#endif

  class bad_alloc : public exception {
  public:
    virtual const char* what() const throw() { return "bad_alloc"; }
  };

  struct nothrow_t {};
  extern const nothrow_t nothrow;
  typedef void (*new_handler)();
  new_handler set_new_handler (new_handler);

// replaceable signatures
void *operator new (size_t) throw (std::bad_alloc);         (line 32)
void *operator new[] (size_t) throw (std::bad_alloc);
void operator delete (void *) throw();
void operator delete[] (void *) throw();
void *operator new (size_t, const nothrow_t&) throw();
void *operator new[] (size_t, const nothrow_t&) throw();
void operator delete (void *, const nothrow_t&) throw();
void operator delete[] (void *, const nothrow_t&) throw();

// default placement versions of operator new
inline void *operator new(size_t, void *place) throw() { return place; }
(line 42)
inline void *operator new[](size_t, void *place) throw() { return place; }
} // extern "C++"

#endif


Any help will be appreciated.
0
Comment
Question by:kimk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Author Comment

by:kimk
ID: 8154974
very urgent!!!
0
 
LVL 1

Expert Comment

by:jadams117
ID: 8155514
What does your code look like?
0
 
LVL 6

Accepted Solution

by:
Mafalda earned 300 total points
ID: 8155534
Well, you can search for the error in google ...

All the information I could find was refering to a compiler problem, thus suggesting using a newer version of the copiler ... in some cases even calling the compiler a poor C++ compiler

See in example
http://www.uclinux.org/pub/uClinux/archive/3866.html
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:kimk
ID: 8166659
1.My code does nothing, the error is from the include/new file.
2.I have seen this topis, but it is from September 2001! Does it mean that I cannot use C++ for uClinux??
0
 
LVL 6

Expert Comment

by:Mafalda
ID: 8168589
Try to obtain the latest version of the compiler you work with.
Usually it solves the problem
0
 
LVL 9

Expert Comment

by:tinchos
ID: 9502267
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Please Review

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question