I have this file: myfuncts.hpp
:
#ifndef FUNCTS_
#define FUNCTS_
namespace root {
namespace functs {
template <typename T>
class f1 {
public:
T r;
f1();
};
}
}
#endif
I have the implementation: myfuncts.cpp
:
#include "myfuncts.hpp"
template <typename T>
root::functs::f1<T>::f1() { /* do somethng */ }
Then I have my main routine:
#include "impulses.hpp"
int main(int argc, char** argv);
int main(it argc, char** argv) {
root::functs::f1<double> f();
}
I compile it:
g++ main.cpp functs.cpp
And got this:
/tmp/ccrdJEQt.o: In function
main': main.cpp:(.text+0x53): undefined reference to
root::functs::f1::f1()' collect2: ld returned 1 exit status
What am I doing wrong?