Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Linking with "nothrownew.obj" (MSVC Express)

Avatar of forums_mp
forums_mp asked on
C++
10 Comments1 Solution1516 ViewsLast Modified:
Code referenced below is generating an exception in MSVC 2010 express.  According to Microsoft I must link with '"nothrownew.obj" if I want the non throwing version of new.  So I added  (I think) nothrownew.obj.  To do this I did:

1) Right click on the project name
2) Select Properties
3) Select Linker menu
4) Added "nothrownew.obj"  (with quotes) to Additional Options field.
5) Depressed Ok

Compile and ran program but code still generates 'exception'.  IOW:  It appears I'm not using the nothrow form of new.   The end result is the same if I used MSVC express 2008.  What am I missing in my steps?
# include <iostream>
# include <numeric>

int main() 
{
  long const max = std::numeric_limits < long >::max(); 
  long *ptr = new ( std::nothrow ) long [ max ];
  if ( ptr ) 
  {

  }

}
ASKER CERTIFIED SOLUTION
Avatar of habeeballah
habeeballahFlag of India image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answers