user520621
user520621

Reputation:

Why does the compiler not see this function header?

My function header is this:

void FileIO::write(LinkedList<Librarian>& librarians, int numlibrarians,
                   LinkedList<Patron>& patrons, int numpatrons,
                   LinkedList<LinkedList<Item> >[] items, int numitems,
                   int currid)

The header in my .h is this:

void write(LinkedList<Librarian>&, int, LinkedList<Patron>&, int,
           LinkedList<LinkedList<Item> >[], int, int);

And yet, when I try to compile my program I get this error:

FileIO.cpp:923: error: prototype for ‘void FileIO::write(
LinkedList<Librarian>&, int, LinkedList<Patron>&, int,
LinkedList<LinkedList<Item> >*)’ does not match any in class ‘FileIO’

Why would this be? It seems like every one of my headers where I put > >[] is not recognized. Is there any other way to do this?

Upvotes: 2

Views: 125

Answers (3)

Jonathan Leffler
Jonathan Leffler

Reputation: 754820

It appears that the write() function at line 923 is missing two integer parameters that are needed to make it correspond to the declarations.

Upvotes: 0

Andrew White
Andrew White

Reputation: 53516

This is C++ so LinkedList<LinkedList<Item> >[] items doesn't make sense since this is a Java construct. Actually the parser is bombing out early somehow thinking the [] is some token which is indeed odd. Replace with LinkedList<LinkedList<Item> > items[] and you should be good.

Upvotes: 2

robert
robert

Reputation: 34438

Try changing

LinkedList<LinkedList<Item> >[] items

to

LinkedList<LinkedList<Item> > items[]

Upvotes: 2

Related Questions