By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,834 Members | 1,923 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,834 IT Pros & Developers. It's quick & easy.

how can I get the call __PRETTY_FUNCTION__ runing?

P: n/a
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!
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Thomas wrote:
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.

Jul 19 '05 #2

P: n/a
> 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.

--
Peter van Merkerk
peter.van.merkerk(at)dse.nl


Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.