none
Visual Studio 2005 C++ CXX0052: member function not present

    Question

  • I get this message when trying to evalute a function of a template class (native C++). Non-template class functions work.

    Example (trying to evalute "x.f()") :

    template< int i >
    class C
    {
       const int m_i;
    public:
       C( void ) :
       m_i( i )
       {
       }
       int f( void )
       {
          return( m_i );
       }
    };

     

    void main( void )

    {
       C<5> x;
       return;  // Set the breakpoint here and try to evaluate x.f()
    }

    Is there any way to get the debugger to evalute such a function call?

     

    void main( void )
    Thursday, September 16, 2010 7:55 AM

Answers

  • I did a copy and paste test and got an error saying "error: 'x.f' does not exist" in Visual Studio 2010 ultimate edition.

    An alternative way is to make a variable, say, temp, to store the result return from f() and then view the temp variable from Locals or Watch window or Immediate window etc... Hence, I add a little bit more code:

    void main( void )
    {
       C<5> x;
       int temp = x.f();
       return;  // Set the breakpoint here and try to evaluate x.f()
    }

    After that, it evaluates temp without errors or warnings.

    Hope this helps

    • Proposed as answer by Roahn Luo Monday, September 20, 2010 9:19 AM
    • Marked as answer by Roahn Luo Tuesday, September 21, 2010 9:56 AM
    Friday, September 17, 2010 9:46 AM