I get 'error LNK2001: unresolved external symbol' when I comment in my constructor
in my derived class.
My base class defines a virtual OnEnter
and OnExit
, my derived class implements those functions, all is good. Then when I add a constructor to my derived class it wont compile.
1>State.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall State::OnEnter(void)" (?OnEnter@State@@UAEXXZ)
1>State.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall State::OnExit(void)" (?OnExit@State@@UAEXXZ)
State is my base class.
//State.h
#ifndef STATE_H
#define STATE_H
class State
{
public:
virtual void OnEnter();
virtual void OnExit();
};
#endif
//State.cpp
#include "State.h"
//DateEntryView.h
#ifndef DATE_ENTRY_VIEW_H
#define DATE_ENTRY_VIEW_H
#include "State.h"
class DateEntryView
: public State
{
public:
DateEntryView();
public:
void OnEnter();
void OnExit();
};
#endif
//DateEntryView.cpp
#include "DateEntryView.h"
DateEntryView::DateEntryView()
{
}
void DateEntryView::OnEnter()
{
}
void DateEntryView::OnExit()
{
}