You are not logged in.
I got an error when building my program. The program was working fine for a while before showing this error:
In file included from truck.cpp:1:
truck.h:62: error: ISO C++ forbids declaration of ‘linkedStackType’ with no type
truck.h:62: error: expected ‘;’ before ‘<’ token
truck.h:63: error: ISO C++ forbids declaration of ‘linkedStackType’ with no type
truck.h:63: error: expected ‘;’ before ‘<’ token
#include "orderedLinkedList.h"
#include <string>
#include <iostream>
using namespace std;
#ifndef TRUCK_H
#define TRUCK_H
class truck {
public:
truck();
// default constructor; number and price are are set to -1 and sold is set
// to false
truck(int truckNumber, string typeOfLoading);
// constructor
truck(truck &s);
// copy constructor
~truck();
// destructor
bool hasCargo ();
void addItems (string items);
void unload ();
void load ();
int getTruckNumber();
string getTypeOfLoading();
bool operator==(const truck &s) const;
bool operator!=(const truck &s) const;
const truck & operator=(const truck &s);
friend istream & operator>>(istream &in, truck &s);
friend ostream & operator<<(ostream &out, truck &s);
linkedStackType<string> pickupCargo;
linkedStackType<string> deliveryCargo;
private:
int truckNumber;
string typeOfLoading;
orderedLinkedList<string> cargoItems;
linkedListIterator<string> *cargoIterator;
};
#endif /* TRUCK_H */
Moderator: [ewaller] I fixed your code tags for you
Last edited by sackocool (2011-04-26 03:58:43)
Offline
You need to use "[" brackets for your code blocks....
Anyway... do you include the header for your "linkedStackType" in there? It does not look like it unless that is in "orderedLinkedList.h".
Offline
Thank you so much. I had so many reciprocal including I thought it was included by linkedList which is included by orderedLinkedList.h. Thanks again.
Offline
Please mark the thread as [SOLVED] once it is. Edit your first post (you should also use proper code tags as Allan said).
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
Thank you so much. I had so many reciprocal including I thought it was included by linkedList which is included by orderedLinkedList.h. Thanks again.
Don't depend on that type of including. If your source file depends on a definition, include the header that contains that definition; don't expect some other header to include it for you.
Related: ensure all your headers are multi-include-safe (with a nice big #ifndef at the top) - I see you doing this in the file you pasted, so good stuff
Offline
Yeah I got your point. Thanks a lot.
Offline