Question: I keep getting these errors when I run my code assign6.o: In function `main': assign6.cpp:(.text+0x24): undefined reference to `Queue ::Queue()' assign6.cpp:(.text+0x49): undefined reference to `std::ostream&
I keep getting these errors when I run my code
assign6.o: In function `main': assign6.cpp:(.text+0x24): undefined reference to `Queue
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Queue.h file
#ifndef QUEUE_H #define QUEUE_H
#include
template
template
template
class Queue { friend std::ostream & operator<< <>(std::ostream &, const Queue
private: T* queArray; size_t queCapacity; size_t queSize;
int frontQ;
int backQ;
public: Queue(); ~Queue();
Queue(const Queue
void clear();
size_t size()const; size_t capacity(); bool empty()const;
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Queue.cpp
#include "Queue.h"
//default constructor template
//copy constructor template
queArray = new T[queCapacity];
frontQ = other.frontQ; backQ = other.backQ;
for(int i = 0; i < other.queSize; i++) { queArray[i] = other[i]; } }
template
template
template
else { return false; } }
template
template
for(int i = 0; i < queSize; i++) { this->queArray[i] = other[i]; }
return *this; }
template
current = (current + 1)% rightObj.queCapacity; }
return leftObj; }
////////////////////////////////////////////////////////////////////////////////////////////////
Testfile assign6.cpp
#include
using std::cout; using std::endl; using std::underflow_error;
int main() { cout << "Testing default constructor "; Queue
cout << "q1: " << q1 << endl; cout << "q1 size: " << q1.size() << endl; cout << "q1 capacity: " << q1.capacity() << endl; cout << "q1 is " << ((q1.empty()) ? "empty " : "not empty "); cout << endl;
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
desired output
Testing default constructor q1: q1 size: 0 q1 capacity: 0 q1 is empty
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
