CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Mar 2009
    Posts
    1

    Baffling Problem

    Hi. I have an unusual problem here. The code seems fine but VC++ is giving me the following errors:

    error C2143: syntax error : missing ';' before '*'
    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    error C2065: 'T' : undeclared identifier

    The line of code that gives the error is:

    template <typename T> class LinkedList
    {
    class ListNode;
    class Lookuptable;
    };

    template <typename T> class LinkedList::LookupTable
    {
    public:
    ListNode* get( int );

    private:
    ListNode* *nodeTable;
    };

    template <typename T> ListNode* LinkedList<T>::LookupTable::get( int pos ) //errors on this line
    {
    return nodeTable[ pos ];
    }

    [P.S. All unneccessary code removed. When the function template get( int pos ) is removed (leaving the forward function declaration in the LookupTable inner class), code compiles fine.]

    [P.S.S. LookupTable is simply an array of ListNode pointers.]
    Last edited by Zwischenzug; March 18th, 2009 at 05:41 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured