In Visual Studio 2008, I started a new project based on the wizard for “Win32 Console Application” and using the MFC libraries. Then I added the necessary includes and libraries from ROOT. When I include TFile.h and create a new instance of a TFile (or basically any TObject-derived object) I get this compile error:
error C2661: ‘TObject::operator new’ : no overloaded function takes 3 arguments
Interestingly enough, the error goes away when I comment out the line
#define new DEBUG_NEW
which is created by the wizard. I don’t know if that line is important, so I can just leave it out, but I’m curious why this line causes a compile error with TObjects.
I attach the .cpp of my test project and I can provide the complete project on request.
to clarify this even more: Microsoft does an unbelievable thing, changing the definition of the C++ keyword “new” throughout your code to read DEBUG_NEW. They could just as well redefine “for” or “return”! Of course this breaks tons of code that uses new, e.g. as a member function. Really, un-be-lievable.
You did the right thing, uncommenting that #define. Thanks for letting us know!