Solved

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

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create a path if not exists 7 108
No module found pypyodbc, 3 43
One named event, multiple event handlers 2 40
How to add columns to a RAD Studio FMX grid at design time 1 28
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

762 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