Abstract class error? (MinGW)
I'm getting a error that's I don't know why. First, here is my codes:
//IProgram.h
class IProgram
{
public:
virtual void Log(const char* msg) = 0;
};
//Program.h
#include "IProgram.h"
class Program
{
private:
IProgram &m_IProgram;
public:
Program(IProgram &iprg) : m_IProgram(iprg)
{
m_IProgram.Log("Program initialized!");
}
};
//MyClass
#include "IProgram.h"
class MyClass : public IProgram
{
private:
Program m_Program;
void Log(const char* msg)
{
printf("%s\n", msg);
}
public:
MyClass() : m_Program(*this) { }
};
The problem is, if I include another header like pthread.h to 'Program.h'
compiler (MinGW) says: "expected ',' or '...' before 'struct'" and
"expected primary-expression before 'struct'". Error is casting from
'Program(IProgram &iprg)' constructor. What's wrong?
(IProgram is not a struct, it is a abstract class. And compiler called it
with "struct"?)
EDIT: If I don't include anything (only Interface.h), there is no error.
No comments:
Post a Comment