Type name expected: Errors

Discussion in 'C++' started by Andrew Edwards, Jul 27, 2003.

  1. Could someone please tell me what I'm doing wrong? The compiler barks at me
    whenever I throw (bad_alloc). If I remove this the code compiles just fine.

    template < class DT, class KF >
    class BSTree;

    template < class DT, class KF >
    class BSTreeNode
    {
    private:
    friend class BSTree<DT,KF>;
    };

    template < class DT, class KF >
    class BSTree
    {
    void insert ( const DT &newDataItem )
    throw ( bad_alloc );
    };

    template < class DT, class KF >
    void insert ( const DT& newDataItem )
    throw ( bad_alloc )
    {

    }

    int main()
    {
    BSTree<int,myStruct> X;
    return 0;
    }

    ---------- Capture Output ----------
    "C:\Borland\BCC55\Bin\bcc32.exe" C:\lab11\Text3.cpp
    Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
    C:\lab11\Text3.cpp:
    Error E2303 C:\lab11\Text3.cpp 15: Type name expected
    Error E2303 C:\lab11\Text3.cpp 20: Type name expected
    *** 2 errors in Compile ***
    Terminated with exit code 1
    Andrew Edwards, Jul 27, 2003
    #1
    1. Advertising

  2. Gentlemen,

    Thank you, I have finally figured out my problem.

    Andrew
    Andrew Edwards, Jul 27, 2003
    #2
    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. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    941
    Mark Goldin
    Jan 17, 2004
  2. Zenon
    Replies:
    6
    Views:
    4,821
    Rolf Magnus
    Nov 13, 2003
  3. Sergei Gnezdov

    type* name vs. type *name

    Sergei Gnezdov, Mar 29, 2005, in forum: C Programming
    Replies:
    5
    Views:
    287
    Gordon Burditt
    Mar 29, 2005
  4. =?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=

    MALLOC: TYPE NAME EXPECTED

    =?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=, Nov 21, 2006, in forum: C Programming
    Replies:
    2
    Views:
    511
    =?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=
    Nov 21, 2006
  5. Replies:
    1
    Views:
    2,309
Loading...

Share This Page