I have entered into a circular include problem. I have a class:
Code:
#include "TestConnection.h"
#include "oci.h"
#include "SU_ORADB_imp.h"
class DBTestConnection final : public Connection
{
private:
SU_ORADB_imp* imp_{ nullptr };
bool m_connected = false;
// methods
DBTestConnection();
// friend class
friend ConnectionPoolFactory<DBTestConnection>;
public:
bool heart_beat() override { return m_connected; }
bool is_healthy() override { return m_connected; }
void disconnect() override;
bool connect() override;
void do_something();
~DBTestConnection() override;
OCISvcCtx* GetServerContext() { return imp_->_svchp; }
};
and another class:
Code:
#pragma once
#include "oci.h"
#include "ConnectionFactory.h"
class SU_ORADB_imp
{
private:
OCISvcCtx* _svchp; // just for testing purpose
// methods
void Init();
protected:
PoolProxy GetConnection();
static std::unique_ptr<ConnectionPool> pool_;
public:
void Connect();
void Disconnect();
SU_ORADB_imp();
~SU_ORADB_imp();
void DoSqlSelect();
friend class DBTestConnection;
};
but I got these errors:
Code:
dbtestconnection.h(10): error C2143: syntax error: missing ';' before '*'
dbtestconnection.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
dbtestconnection.h(10): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
dbtestconnection.h(24): error C2065: 'imp_': undeclared identifier
and
Code:
connectionfactory.h(11): error C2065: 'DBTestConnection': undeclared identifier
connectionfactory.h(12): error C2923: 'ConnectionPoolFactory': 'DBTestConnection' is not a valid template type argument for parameter 'T'
connectionfactory.h(27): error C2913: explicit specialization; 'ConnectionPoolFactory' is not a specialization of a class template
How can I get rid of this issue ? Can you help me a little bit ? I put here a test project to illustrate my problem.