Solved

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

Posted on 2007-03-21
3
1,873 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 50 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now