?
Solved

error C2039: 'bad_alloc' : is not a member of 'std'

Posted on 2007-03-21
3
Medium Priority
?
1,988 Views
Last Modified: 2013-11-17
Visual C++ 2005 running in Visual Studio Professional

When I type this:

try {
    dk->tkBuf = new TOKEN[lgTkBuf];
    }
catch (std::bad_alloc& ba){}

as I type the std::  the editor obligingly displays a member list for std which includes , but when I compile it I'm told:

error C2039: 'bad_alloc' : is not a member of 'std'

Anyone any ideas?
0
Comment
Question by:johnewingfr
  • 2
3 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 100 total points
ID: 18764283
Try adding :

#include <new>
0
 

Author Comment

by:johnewingfr
ID: 18764381
Dang!!!  I *had* added it, but *before* #include "stdafx.h" so it wasn't being looked at.

I've been banging my head off that for two hours.  Thanks for making me look again.
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 18764812
Heh ... it happens to all of us :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

809 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