- #1
FYAD
- 5
- 0
I'm writing a Steque class that will inherit from my Stack and Queue classes. When I try to link it, I'm getting this weird error, which I'm sure has something to do with trying to inheritance.
Queue.h
When I try to run it:
In my steque.cc class, I have nothing but the contructor and main. I'm just trying to get it to compile before I start writing code for it. This is my third c++ program, so I'm not sure what the problem is.
Queue.h
Code:
#include <iostream>
#include <cstddef>
#include <stdlib.h>
using namespace std;
typedef string Itemtype;
struct NodeType;
typedef NodeType *NodePtr;
typedef struct NodeType{
Itemtype item;
NodePtr next;
NodePtr last;
};
class Queue{
public:
Queue();
~Queue();
.
.
.
more stuff
.
Steque.h
#include "Queue.h"
//#include "Stack.h"
class Steque : virtual public Queue{
public:
Steque();
};
Steque.cc
#include "Steque.h"
Steque::Steque(){
}
main(){
}
When I try to run it:
Code:
$ g++ -g -c Steque.cc
$ make
g++ -g -o Steque Steque.o
Steque.o(.text+0x20): In function `Steque::Steque[in-charge]()':
/home/john/Steque.cc:4: undefined reference to `Queue::Queue[not-in-charge]()'
collect2: ld returned 1 exit status
make: *** [Steque] Error 1
In my steque.cc class, I have nothing but the contructor and main. I'm just trying to get it to compile before I start writing code for it. This is my third c++ program, so I'm not sure what the problem is.