I have two source files, one is a .h and another .hpp for the implementation of the .h class template the .h has the following code:
'''
#ifndef LSTACK_H
#define LSTACK_H
template <typename T>
class LStack
{
public:
LStack();
~LStack();
// Mutator member functions
void push(const T& entry);
T pop();
bool isEmpty() const;
// Query member functions
int size() const;
T& peek(); // sometimes top(), but not in 1120!
private:
T data; // LinkedList Member
int used;
};
#include "LStack.hpp" // include the ‘implementation’
// part of Template
#endif
'''
The .hpp code is below:
'''
#ifndef LSTACK_HPP
#define LSTACK_HPP
template <typename T>
LStack<T>::LStack() {} // default constructor
template <typename T>
LStack<T>::~LStack() {} // needs to handle data member T
template <typename T>
void LStack<T>::push(T& obj)
{
data.addToHead(obj);
}
template <typename T>
T LStack<T>::pop()
{
return data.removeFromHead();
}
#endif // LSTACK_HPP
'''
I am getting a Semantic error "LStack.hpp:: No template named 'LStack'" I can't seem to figure out the problem