![]() |
|
#1
|
|||
|
|||
The Bag Class with a LinkedListHi guys.
I am creating a bag class with a Linkedlist. The aim of the program is to insert a set of words into the LinkedList and for it to return the size and other not important things. I am not sure if i am declaring the LinkedList correctly. there are also two more files node.h and node.cpp, however these have been tested and work the error i get is LinkedList.cpp:15: error: ‘LinkedList’ has not been declared LinkedList.cpp:15: error: expected constructor, destructor, or type conversion before ‘;’ token LinkedList.cpp:17: error: ‘LinkedList’ has not been declared The code is CPP / C++ / C Code:
Any help would be greatly appreciated |
|||
|
#2
|
|||
|
|||
Re: The Bag Class with a LinkedListQuote:
Maybe one problem is the namespace inconsistency??? CPP / C++ / C Code:
But ... CPP / C++ / C Code:
There are other problems, but this is where I would start. Regards, Dave |
|
#3
|
|||
|
|||
Re: The Bag Class with a LinkedListHi thanks,
I think i did that when i was transferring it into the window. It still has same error. what are the other problems? cheers |
|
#4
|
|||
|
|||
Re: The Bag Class with a LinkedListQuote:
OK. I will tell you a little story. Before I post suggestions to try to help other people learn, I try guess what is happening, then I (almost) always try to reproduce the posted problem and see if my suggestion(s) might make a difference. Since you didn't post node.h, I kludged up a "node" struct so that I could see what a compiler did with the code that you did post. Then I compiled LinkList.cpp by itself (with g++ -c LinkedList.cpp) Among other things one message that I got was similar to your error. Namely: Code:
Now, when I changed the namespace statement in LinkedList.cpp to CPP / C++ / C Code:
I did not get that error. (I got lots of others, though.) Here's the deal: If you are still getting an error about "LinkedList has not been declared", then either 1. You have a problem in your namespace statements as I pointed out in your original post. or 2. Other parts of the code that you are running are not the same as the code that you posted or 3. Something in node.h is inconsistent with the code that you posted and/or the code that you are using. or 4. Some combination of any and/or all of the above or 5. Something else. Quote:
"Linked List has not been declared" is a major problem. Find out how to get rid of it. Then go through the remaining errors one at a time. See Footnote. I also think that chances for getting meaningful help in learning to debug would be improved if you are absolutely sure that the code you post is exactly the same as the code you are using. Regards, Dave Footnote: "We can face our problem. We can arrange such facts as we have with order and method." Hercule Poirot --- in Murder on the Orient Express Last edited by davekw7x : 10-Sep-2009 at 13:47.
|
Recent GIDBlog
Install Adobe Flash - Without Administrator Rights by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hard drive/CPU Diagnoses Issues | binarybug | Computer Hardware Forum | 1 | 22-Jan-2007 20:23 |
| Box Class, need help again :( | TransformedBG | C++ Forum | 7 | 13-Nov-2006 16:11 |
| C++ class -- Please help | vnca_1 | C++ Forum | 3 | 14-Jun-2006 13:31 |
| a tester class and then some. | postage | Java Forum | 1 | 06-May-2006 16:48 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The