template linking
Hello,
how I can get it linked?
nr.h
1 2 3 4 5 6 7 8 9 10
|
namespace NR {
template <typename T>
T mpoint2(const std::map<T, T> &data, const T x);
}
template <typename T>
T NR::mpoint2(const std::map<T, T> &data, const T x) {
typedef typename std::map<T, T>::const_iterator iter;
...
}
|
main.cpp
1 2 3 4 5
|
double E,y;
std::map<double, double> escs;
y = NR::mpoint2(escs,E);
...
|
undefined reference to `double NR::mpoint2<double>(std::map<double, double, std::less<double>, std::allocator<std::pair<double const, double> > > const&, double)'
|
I don't see a problem with the code you have posted. Could perhaps post a complete example.
Topic archived. No new replies allowed.