Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > how can I get the call __PRETTY_FUNCTION__ runing?

Reply
Thread Tools

how can I get the call __PRETTY_FUNCTION__ runing?

 
 
Thomas
Guest
Posts: n/a
 
      09-02-2003
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!
 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      09-02-2003
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.

 
Reply With Quote
 
 
 
 
Peter van Merkerk
Guest
Posts: n/a
 
      09-02-2003
> 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




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
combine __FILE__, __LINE__, __PRETTY_FUNCTION__ PengYu.UT@gmail.com C++ 5 11-11-2006 08:00 PM
When I call malloc() to get some space, I get Segmentation fault Zheng Da C Programming 3 06-02-2005 08:54 PM
Javascript can get time, can it get milliseconds, or actually just tenths of seconds? Guy Javascript 2 12-05-2003 04:00 PM



Advertisments