how can I get the call __PRETTY_FUNCTION__ runing?

Discussion in 'C++' started by Thomas, Sep 2, 2003.

  1. Thomas

    Thomas Guest

    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!
    Thomas, Sep 2, 2003
    #1
    1. Advertising

  2. Thomas

    Rolf Magnus Guest

    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.
    Rolf Magnus, Sep 2, 2003
    #2
    1. Advertising

  3. > 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
    Peter van Merkerk, Sep 2, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nikolay Petrov

    Runing Client-side code

    Nikolay Petrov, Mar 22, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    616
    Jason Mauss
    Mar 24, 2005
  2. Replies:
    1
    Views:
    498
    Larry
    Mar 7, 2006
  3. Peng Yu
    Replies:
    7
    Views:
    374
    Anoop Aryal
    Mar 29, 2005
  4. Replies:
    5
    Views:
    825
  5. mg
    Replies:
    0
    Views:
    118
Loading...

Share This Page