Sign in to follow this  
matthughson

set_new_handler( ) with memory manager [SOLVED]

Recommended Posts

Hey All, Just in the process of porting over some projects from Visual Studio 6, to the new VS 2K5 Beta. The project I'm working on now is using Fluid Studio's Memory Manager. The memory manager worked great in VS6, but will not compile since I've ported over to VS 2K5. I am getting this error:
mmgr.cpp(791) : error C3861: 'set_new_handler': identifier not found
Which points to these lines of code in the memory manager:
		new_handler	nh = set_new_handler(0);
		set_new_handler(nh);
The weird part is that I can still right click the function, and the click go to definition, which does in fact take me to it. So it seems the IDE knows about it, but not the compiler. I also check MSDN, which still has the function listed, so I know it hasn't been removed or something like that. If anyone has any suggestions, I would totally appretiate it! Matt Hughson [Edited by - matthughson on June 4, 2005 4:18:07 PM]

Share this post


Link to post
Share on other sites
Ok, so I tried changing:

#include <new>

to

#include <new.h>

which got rid of the errors mentioned in the previous posts in this thread, however, I now get a linker error:

LINK : fatal error LNK1104: cannot open file 'libcp.lib'

According to MSDN this lib is associated with new and delete, but I'm not sure why I am getting this error.

I also noticed in the MSDN example they use #include <new> without the .h, so I'm wondering if that switch was not the right thing to do.

Update:

Out of curiosity, I completely removed the memory manager from the project. Yet, I still get that linker error. So it would seem that changing to new.h did fix the problem, and the linker error is something new.

Any suggestions on what else to try?

Matt Hughson

Share this post


Link to post
Share on other sites
ok, ok.

Solution incase anyone runs into the same problem.

Did a find on my computer for that lib file. Turns out it was on there, but in the VS 6 folder. VS2K5 doesn't seem to include it. So all I did was copy the lib file into the lib directory of VS2K5 and now everything works fine.

Matt Hughson

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That may be a bad solution.

Note that I am pretty sure in VC7 and later set_new_handler is in namespace standard, so it may be that the code should read:

new_handler nh = std::set_new_handler(0);
std::set_new_handler(nh);

when including which is DEF what you should do. There is a reason that MSVC7 does not include the old library.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this