This question already has an answer here:
I have this template class where I want to isolate member function definition from header to cpp file. class has more member function but not listed here for simplicity. Just a constructor is included here.
template<uint32_t bind_type>
class bind_pdu: public pdu {
public:
bind_pdu();
};
cpp file for constructor definition is used as
template<uint32_t bind_type>
bind_pdu<bind_type>::bind_pdu():pdu(bind_type){
}
I am using c++11 using command to declare a new type like
using bind_another_type = bind_pdu<111>
and using this type to use default constructor as
bind_another_type mybind;
error I am getting at this line of code is
undefined reference to `smpp::pdu::bind_pdu<2u>::bind_pdu()
template works perfectly if I put member functions in header files. but with cpp file it doesn't behave as I expect it to. I am using gcc 4.8 with c++11 option enable.
any help will be appreciated
Regards
Aucun commentaire:
Enregistrer un commentaire