Hello Everyone,

I am getting the following error on line 12.

"variable or field 'start' declared void"

I have deleted quite a bit of code, in case your wondering what the program is supposed to do. I don't understand why the compiler would have a problem with this function being void when it does not return anything.

#include "utility.h"
#include "Item.h"
#include "Event.h"
using namespace std;


template< typename T > void printStack( T &stackRef );
template< typename T > void printQueue( T &queueRef );
template <typename InputIterator> void printList(InputIterator first, InputIterator last);
template< typename T > bool checkQueue( T &queueRef );
template< typename T > void loadPlane( T &chiStack, T &mempStack);
template< typename T >void start( List<Event> &mylist, T &ePackage, T &ePlane, T &endOfService );


int main()
{
    const int maxTime = 2000;
    stack< Item > chicagoStack;
    stack< Item > memphisStack;
    queue< Item > packageQueue;
    queue< Item > planeQueue;
    list<Event> mylist;
	list<Event>::iterator current;                                      //pointer into the list

	Item iPackage;
	Item iPlane;
    Event ePackage;
    Event ePlane;
    Event endOfService;

    int time = 0;





template< typename T >void start( List<Event> &mylist, T &ePackage, T &ePlane, T &endOfService )
{
    ePackage.makeEvent(5, "package", "Memphis");
    mylist.push_back(ePackage);

    endOfService.makeEvent(8, "End of Service", "endOfService");
    mylist.push_back(endOfService);

    ePlane.makeEvent(6, "planeChicago", "Chicago");
    mylist.push_back(ePlane);

    ePlane.makeEvent(5, "planeMemphis", "Memphis");
	mylist.push_back(ePlane);

}

You wrote "List" instead of "list", C++ is a case-sensitive language.

Because the compiler does not recognize the "List" as a type (and thus starting a declaration of a parameter-list), it thinks that line 12 is a declaration (and initialization) of a "variable or field" called "start" and because it sees it as a "void" type, it gives a compilation error.

Thank you!! That was my problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.