how can I get the call __PRETTY_FUNCTION__ runing?

T

Thomas

Hello im using Visual Studio .net

And have troubel with the following line

ClassA::~ClassA()
{
cerr<<__PRETTY_FUNCTION__<<"\n"; \\this works with g++
}

on compiling I get this back:
filename.cc(20): error C2065: '__PRETTY_FUNCTION__' : undeclared identifier

does exist an library to add or have I just missed an command?
Thanks for your Help!
 
R

Rolf Magnus

Thomas said:
Hello im using Visual Studio .net

And have troubel with the following line

ClassA::~ClassA()
{
cerr<<__PRETTY_FUNCTION__<<"\n"; \\this works with g++
}

on compiling I get this back:
filename.cc(20): error C2065: '__PRETTY_FUNCTION__' : undeclared
identifier

does exist an library to add or have I just missed an command?
Thanks for your Help!

You have missed the fact that __PRETTY_FUNCTION__ is not part of
standard C++ and thus may not be available on every compiler.
 
P

Peter van Merkerk

Hello im using Visual Studio .net
And have troubel with the following line

ClassA::~ClassA()
{
cerr<<__PRETTY_FUNCTION__<<"\n"; \\this works with g++
}

on compiling I get this back:
filename.cc(20): error C2065: '__PRETTY_FUNCTION__' : undeclared identifier

does exist an library to add or have I just missed an command?

__PRETTY_FUNCTION__ is not part of standard C++ but a g++ specific
extension. Consequently you cannot expect every compiler to support
this. If you are satisfied with just file name and line number you might
use a macro like this:

#define PRETTY_FUNCTION __FILE__":" << __LINE__

The predefined macro __FILE__ and __LINE__ are defined in the C++
standard, and should be available on any reasonable compilant C++
compiler. Note that this macro is not an exact equivalent for the
__PRETTY_FUNCTION__ macro; it only works for stream output. With a bit
more effort it can be modified to produce a string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top