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

    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
    ListNode* get( int );

    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.

  2. #2
    Join Date
    Jun 2002
    Stockholm, Sweden

    Re: Baffling Problem

    Put the function declaration directly in the template class instead...
    Nobody cares how it works as long as it works

  3. #3
    Join Date
    Jan 2009

    Re: Baffling Problem

    The get template needs to be terminated with a semicolon.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.