I have MapListDialog which inherits from base class ListView. But I have problem with "undefined reference to" by MapListDialog constructor definition.
//create instance in main.cpp
mapListDialog = new MapListDialog(this);
Definition for MapListDialog inherited from ListView
src/modes/MapListDialog.h
#include <controls/ListView.h>
class MapListItem {
public:
const char *label;
};
class MapListDialog : public ListView<MapListItem> {
public:
//***compiler fails at line below ***
MapListDialog(BaseView *parent): ListView<MapListItem>(parent) {};
~MapListDialog() {};
};
Definition of ListView
src/controls/ListView.h
#include "Dialog.h"
template<class T>
class ListView : public Dialog {
public:
ListView(BaseView *parent);
~ListView();
};
src/controls/ListView.cpp
#include "ListView.h"
template<class T>
ListView<T>::ListView(BaseView *parent):Dialog(parent) {}
template<class T>
ListView<T>::~ListView() { }
I think, is not necessary put here definition of Dialog, but for every case...
class Dialog : public BaseView {
Dialog(BaseView *parent);
~Dialog();
}
class BaseView {
public:
BaseView(BaseView *parent);
~BaseView();
}
MapListDialog.h:23: error: undefined reference to 'ListView::ListView(BaseView*)'