Undefined symbols for architecture x86_64 error
c++, linker
Solution
The answer posted here: https://stackoverflow.com/a/312402/700926 is what I think you need.
If I edit your `Queue.cpp` file to this:
#include "Queue.hpp"
template <typename T>
my::Queue<T>::Queue()
{
}
template class my::Queue<int>;
.. it compiles fine.
For the detailed explanation, please consult the URL i mentioned at first.
Problem
I have this error: ``` Undefined symbols for architecture x86_64: "my::Queue<int>::Queue()", referenced from: _main in ccdwI88X.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status ``` for this code 'main.cpp': ``` #include "Queue.hpp" int main() { my::Queue<int> myqueue; return 0; } ``` 'Queue.hpp': ``` #ifndef QUEUE_HH__ #define QUEUE_HH__ namespace my { template <typename T> class Queue { public: Queue(); }; } #endif ``` and 'Queue.cpp': ``` #include "Queue.hpp" template <typename T> my::Queue<T>::Queue() { } ```