Hi...
I've been wondering this problem for a while today. I thought it can't be this weird because it's in so small scale...but...here it is. Maybe you understand why it gives me unresolved external?
normal_screen.h:
Code:
#ifndef NORMAL_SCREEN_H
#define NORMAL_SCREEN_H
#include "clock_window.h"
class Normal_screen : public Clock_window {
public:
Normal_screen();
~Normal_screen();
Clock_window& gClockWin();
private:
Clock_window clockWin;
};
#include "normal_screen.cpp"
#endif
normal_screen.cpp:
Code:
#ifndef NORMAL_SCREEN_CPP
#define NORMAL_SCREEN_CPP
Normal_screen::Normal_screen() {}
Normal_screen::~Normal_screen() {}
Clock_window& Normal_screen::gClockWin() {
return clockWin;
}
#endif
So...should be very simple but still it gives me two errors:
"[Linker Error] Unresolved external 'Normal_screen::~Normal_screen()' "
and
"[Linker Error] Unresolved external 'Normal_screen::Normal_screen()' ".
And yet it works if I define the constructor and destructor in file normal_screen.h like this:
Code:
#ifndef NORMAL_SCREEN_H
#define NORMAL_SCREEN_H
#include "clock_window.h"
class Normal_screen : public Clock_window {
public:
Normal_screen();
~Normal_screen();
Clock_window& gClockWin();
private:
Clock_window clockWin;
};
Normal_screen::Normal_screen() {}
Normal_screen::~Normal_screen() {}
#include "normal_screen.cpp"
#endif
So, how's that possible?? Something about linker/compiler options?