So the code that works is this:

objectdatabase.h
Qt Code:
  1. ...
  2. class ObjectDatabase{
  3. public:
  4. static bool openDatabase(QString);
  5. static bool createTables();
  6. static void closeDatabase();
  7. static bool vacuumDatabase();
  8. static QString errorString();
  9. protected:
  10. static void setErrorString(QString);
  11. private:
  12. static QString m_errorString;
  13. };
  14. ...
To copy to clipboard, switch view to plain text mode 

objectdatabase.cpp
Qt Code:
  1. ...
  2. QString ObjectDatabase::m_errorString;
  3. ...
  4. void ObjectDatabase::setErrorString(QString string){
  5. m_errorString=string;
  6. }
  7. ...
To copy to clipboard, switch view to plain text mode 

Thanks to all