[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2007-03-21
3
Medium Priority
?
1,957 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
[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
  • 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

649 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