I am relative new to cpp and I have stumbled upon a linker failure I can't trace.
I was trying out Google Test, and I tried to rewrite the inline header sample (sample-3inl.h) to a separate source and header file.
My folder structure looks like this:
Project structure:
├── src
│ ├── queue.cpp
│ ├── queue.h
│ ├── CMakeLists.txt
├── test
│ ├── lib
│ │ ├── gtest
│ │ │ ├── googletest
│ ├── unit_test
│ │ ├── unit_test.cpp
│ │ ├── CMakeLists.txt
│ ├── CMakeLists.txt
├── main.cpp
├── CMakeLists.txt
Google Test works fine, I have tried it with the original sample-3inl.h.
Linker failiure error:
Undefined symbols for architecture x86_64:
"Queue<int>::Enqueue(int const&)", referenced from:
QueueTest::SetUp() in dummy.cpp.o
"Queue<int>::Queue()", referenced from:
QueueTest::QueueTest() in dummy.cpp.o
"Queue<int>::~Queue()", referenced from:
QueueTest::QueueTest() in dummy.cpp.o
QueueTest::~QueueTest() in dummy.cpp.o
"Queue<int>::Size() const", referenced from:
QueueTest_IsEmptyInitially_Test::TestBody() in dummy.cpp.o
ld: symbol(s) not found for architecture x86_64
source code (myqueue.cpp, myqueue.h, and unit_test.cpp) can be found on the following page for simplicity.
Tried to find what causes the error for a couple of hours now but I can't find it, really want to know what I'm doing wrong. Thank you for your time in advance.