This question already has an answer here:
In base.h
I have:
class MyType {};
class Base {
public:
Base(MyType const& t);
MyType t;
};
template <typename T>
class Derived1 : public Base {
public:
Derived1(MyType const& t);
};
In base.cpp
I have
#include "Base.h"
Base::Base(MyType const& t) : t(t) {
}
template<typename T>
Derived1<T>::Derived1(MyType const& t) : Base(t) {
}
In derived.h
I have:
#include "Base.h"
class Derived2 : public Derived1<int> {
public:
Derived2(MyType const& t);
};
In derived.cpp
I have:
#include "Derived.h"
Derived2::Derived2(MyType const& t) : Derived1<int>(t){
}
Yet the linker is telling me that
Derived1<int>::Derived1(MyType const&)
is an undefined symbol. Why doesn't the constructor I have for Derived1
count?
Aucun commentaire:
Enregistrer un commentaire