Hello again!
Once I want to compile I get following errors:
File cdatabaseconnection.h:
#ifndef CDATABASECONNECTION_H
#define CDATABASECONNECTION_H
// qt headers
#include <QObject>
#include <QSqlDatabase>
// c++ stl headers
#include <memory>
{
//Q_OBJECT
public:
//CDatabaseConnection(QObject *parent);
static std
::auto_ptr<CDatabaseConnection>
& Instance
(QObject *parent
);
~CDatabaseConnection();
private:
static std::auto_ptr<CDatabaseConnection> m_pInstance;
};
//typedef std::auto_ptr<CDatabaseConnection> pdbType;
#endif // CDATABASECONNECTION_H
#ifndef CDATABASECONNECTION_H
#define CDATABASECONNECTION_H
// qt headers
#include <QObject>
#include <QSqlDatabase>
// c++ stl headers
#include <memory>
class CDatabaseConnection : public QSqlDatabase
{
//Q_OBJECT
public:
//CDatabaseConnection(QObject *parent);
static std::auto_ptr<CDatabaseConnection>& Instance(QObject *parent);
~CDatabaseConnection();
private:
static std::auto_ptr<CDatabaseConnection> m_pInstance;
};
//typedef std::auto_ptr<CDatabaseConnection> pdbType;
#endif // CDATABASECONNECTION_H
To copy to clipboard, switch view to plain text mode
File cdatabaseconnection.cpp:
#include "cdatabaseconnection.h"
/*
CDatabaseConnection::CDatabaseConnection(QObject *parent)
: QSqlDatabase()
{
}
*/
CDatabaseConnection::~CDatabaseConnection()
{
}
std
::auto_ptr<CDatabaseConnection>
& CDatabaseConnection
::Instance(QObject *parent
){
return m_pInstance;
}
#include "cdatabaseconnection.h"
/*
CDatabaseConnection::CDatabaseConnection(QObject *parent)
: QSqlDatabase()
{
}
*/
CDatabaseConnection::~CDatabaseConnection()
{
}
std::auto_ptr<CDatabaseConnection>& CDatabaseConnection::Instance(QObject *parent)
{
return m_pInstance;
}
To copy to clipboard, switch view to plain text mode
After compilation, I get linker errors:
Error 1 error LNK2001: unresolved external symbol "private: static class std::auto_ptr<class CDatabaseConnection> CDatabaseConnection::m_pInstance" (?m_pInstance@CDatabaseConnection@@0V?$auto_ptr@VC DatabaseConnection@@@std@@A) cdatabaseconnection.obj
Error 2 fatal error LNK1120: 1 unresolved externals C:\Documents and Settings\markofr.NESRAMNIK\Desktop\QBlagajna\Debug \QKlient.exe
Can someone help me please?
Bookmarks