tophirsch
erster Hirsch am Platze
Hallo zusammen,
also folgendes:
Ich habe eine Klasse mit Methoden, die viel Rechenzeit brauchen, also möchte ich den Fortschritt anzeigen. Das wollte ich realisieren, indem die rechenintensive Klasse ein Member-Objekt bekommt, was verschiedenen Funktionen dafür bereitstellt.
Weil das ganze unabhängig davon sein soll, wie nun später die Funktionen zur Fortschrittsanzeige implementiert werden, habe ich zunächst eine abstrakte Basisklasse erstellt, von der ich dann ableite.
Die Basisklasse sieht erstmal so aus:
[src=cpp]//ProgressReporter.h
typedef unsigned int task_id;
class CProgressReporter
{
public:
virtual ~CProgressReporter(void) = 0;
virtual task_id NotifyNewTask(
void* source
,const std::string& taskName
,const unsigned int& totalStepstoDo) = 0;
virtual void NotifyProceed(task_id& taskId, const int& stepsDone = 1) = 0;
virtual void NotifyDone(task_id& taskId) = 0;
};
[/src]
Die davon abgeleitete Klasse so:
[src=cpp]//ProgressReporterImpl.h
#include "ProgressReporter.h"
class CProgressReporterImpl :
public CProgressReporter
{
public:
CProgressReporterImpl(void);
~CProgressReporterImpl(void);
task_id NotifyNewTask(
void* source
,const std::string& taskName
,const unsigned int& totalStepstoDo);
void NotifyProceed(task_id& taskId, const int& stepsDone = 1);
void NotifyDone(task_id& taskId);
private:
[...]
};
[/src]
In meinem eigentlichen Programm wollte ich das nun so verwenden:
[src=cpp]//main.cpp
CProgressReporter* progRep = new CProgressReporterImpl;
timeConsumingObject.SetProgressReporter(progRep);
[/src]
Ich bekomme aber immer folgende Fehler:
[src=cpp]1>ProgressReporterImpl.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: virtual __thiscall CProgressReporter::~CProgressReporter(void)" (??1CProgressReporter@@UAE@XZ)" in Funktion "__unwindfunclet$??0CProgressReporterImpl@@QAE@XZ$0".
1>ProgressReporterImpl.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __thiscall CProgressReporterImpl::NotifyProceed(unsigned int &,int const &)" (?NotifyProceed@CProgressReporterImpl@@UAEXAAIABH@Z)".
1>ProgressReporterImpl.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __thiscall CProgressReporterImpl::NotifyDone(unsigned int &)" (?NotifyDone@CProgressReporterImpl@@UAEXAAI@Z)".[/src]
Was mache ich falsch? Komisch finde ich, das der Fehler für die Funktion "NotifyNewTask" ja nicht auftritt
also folgendes:
Ich habe eine Klasse mit Methoden, die viel Rechenzeit brauchen, also möchte ich den Fortschritt anzeigen. Das wollte ich realisieren, indem die rechenintensive Klasse ein Member-Objekt bekommt, was verschiedenen Funktionen dafür bereitstellt.
Weil das ganze unabhängig davon sein soll, wie nun später die Funktionen zur Fortschrittsanzeige implementiert werden, habe ich zunächst eine abstrakte Basisklasse erstellt, von der ich dann ableite.
Die Basisklasse sieht erstmal so aus:
[src=cpp]//ProgressReporter.h
typedef unsigned int task_id;
class CProgressReporter
{
public:
virtual ~CProgressReporter(void) = 0;
virtual task_id NotifyNewTask(
void* source
,const std::string& taskName
,const unsigned int& totalStepstoDo) = 0;
virtual void NotifyProceed(task_id& taskId, const int& stepsDone = 1) = 0;
virtual void NotifyDone(task_id& taskId) = 0;
};
[/src]
Die davon abgeleitete Klasse so:
[src=cpp]//ProgressReporterImpl.h
#include "ProgressReporter.h"
class CProgressReporterImpl :
public CProgressReporter
{
public:
CProgressReporterImpl(void);
~CProgressReporterImpl(void);
task_id NotifyNewTask(
void* source
,const std::string& taskName
,const unsigned int& totalStepstoDo);
void NotifyProceed(task_id& taskId, const int& stepsDone = 1);
void NotifyDone(task_id& taskId);
private:
[...]
};
[/src]
In meinem eigentlichen Programm wollte ich das nun so verwenden:
[src=cpp]//main.cpp
CProgressReporter* progRep = new CProgressReporterImpl;
timeConsumingObject.SetProgressReporter(progRep);
[/src]
Ich bekomme aber immer folgende Fehler:
[src=cpp]1>ProgressReporterImpl.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: virtual __thiscall CProgressReporter::~CProgressReporter(void)" (??1CProgressReporter@@UAE@XZ)" in Funktion "__unwindfunclet$??0CProgressReporterImpl@@QAE@XZ$0".
1>ProgressReporterImpl.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __thiscall CProgressReporterImpl::NotifyProceed(unsigned int &,int const &)" (?NotifyProceed@CProgressReporterImpl@@UAEXAAIABH@Z)".
1>ProgressReporterImpl.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __thiscall CProgressReporterImpl::NotifyDone(unsigned int &)" (?NotifyDone@CProgressReporterImpl@@UAEXAAI@Z)".[/src]
Was mache ich falsch? Komisch finde ich, das der Fehler für die Funktion "NotifyNewTask" ja nicht auftritt