Within the body of stack's constructor, the (pointless) declaration of LinkedList is missing a template parameter. This is the same for the LinkedList declaration within stack's copy constructor. It should be: LinkedList< T > Something;
but It was giving me errors as well. I'm not sure what should come after the LinkedList< T >. I thought in my stack constructor, since it is using the same member variables as LinkedList, I could just call the LinkedList destructor, but obviously that hasn't been working.
Yes I'm sorry I mean't to say constructor. Buy anyway, I've changed it to what you wrote and it's gotten rid of those errors, but now I have some undefined reference errors in my gtests in case you want to keep helping.
Here is just on of the errors, considering they are almost identical, just varying on which function it has a problem with:
test_stack.cpp:17: undefined reference to `stack<unsignedint>::stack()'
To my untrained eye it's apparently not recognizing my stack class even though I believe I have all of the proper #include's that I need.
1 2 3 4 5 6 7 8
TEST (StackTest, DefaultConstructor)
// Create stack with default constructor
// Test whether size is 0 and isEmpty is true
ASSERT_EQ(0, a.size()) << "\n** Bad DefaultConstructor\n";
ASSERT_NOT_NULL(a.isEmpty()) << "\n** isEmpty should be true\n";
When you separate the definition from the declaration, the linker won't be able the locate the definition it needs to successfully create a class template. Because headers aren't compiled, they don't have an object file. The linker uses object files (which contain the compiled code) to link definitions to declarations. You can solve this in one of 2 ways:
1) #includeing the header where the definitions are at the bottom of the header where the declarations are
2) Place the definitions beneath the class