[SOLVED] QtSingleApplication
-
Hi All!
I write in VS2008, I wont create QtSingleApplication application. I'm create Qt Application, then add to my project path to "src" files QtSingleApplication, then rewrite QtApplication to QtSingleApplication, write @#include "QtSingleApplication"; @ , and start build project. But linker write error:
@1>LINK : D:\Projects\test\test\Debug\test.exe not found or not built by the last incremental link; performing full link
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall QtSingleApplication::QtSingleApplication(int &,char * *,bool)" (??0QtSingleApplication@@QAE@AAHPAPAD_N@Z) referenced in function _main
1>D:\Projects\test\test\Debug\test.exe : fatal error LNK1120: 1 unresolved externals@
Who can tall, why this happen? What is I do wrong?Code main.cpp:
@#include "test.h"#include "QtSingleApplication"
int main(int argc, char *argv[])
{
QtSingleApplication a(argc, argv);
test w;
w.show();
return a.exec();
}@ -
Ok. After adding, I have a more errors: (if i add all of headers and source files "qtlocalpeer", "qtlockedfile", "qtsingleapplication" and "qtsinglecoreapplication")
@1>Linking...
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QLocalServer::QLocalServer(class QObject *)" (_imp??0QLocalServer@@QAE@PAVQObject@@@Z) referenced in function "public: __thiscall QtLocalPeer::QtLocalPeer(class QObject *,class QString const &)" (??0QtLocalPeer@@QAE@PAVQObject@@ABVQString@@@Z)
1>qtlocalpeer.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QLocalServer::metaObject(void)const " (?metaObject@QLocalServer@@UBEPBUQMetaObject@@XZ)
1>qtlocalpeer.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QLocalServer::qt_metacast(char const *)" (?qt_metacast@QLocalServer@@UAEPAXPBD@Z)
1>qtlocalpeer.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QLocalServer::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QLocalServer@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
1>qtlocalpeer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QLocalServer::hasPendingConnections(void)const " (?hasPendingConnections@QLocalServer@@UBE_NXZ)
1>qtlocalpeer.obj : error LNK2001: unresolved external symbol "public: virtual class QLocalSocket * __thiscall QLocalServer::nextPendingConnection(void)" (?nextPendingConnection@QLocalServer@@UAEPAVQLocalSocket@@XZ)
1>qtlocalpeer.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QLocalServer::incomingConnection(unsigned int)" (?incomingConnection@QLocalServer@@MAEXI@Z)
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QLocalServer::~QLocalServer(void)" (_imp??1QLocalServer@@UAE@XZ) referenced in function "public: virtual void * __thiscall QLocalServer::`scalar deleting destructor'(unsigned int)" (??_GQLocalServer@@UAEPAXI@Z)
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QString __thiscall QLocalServer::errorString(void)const " (_imp?errorString@QLocalServer@@QBE?AVQString@@XZ) referenced in function "public: bool __thiscall QtLocalPeer::isClient(void)" (?isClient@QtLocalPeer@@QAE_NXZ)
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QLocalServer::listen(class QString const &)" (_imp?listen@QLocalServer@@QAE_NABVQString@@@Z) referenced in function "public: bool __thiscall QtLocalPeer::isClient(void)" (?isClient@QtLocalPeer@@QAE_NXZ)
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual bool __thiscall QLocalSocket::waitForReadyRead(int)" (_imp?waitForReadyRead@QLocalSocket@@UAE_NH@Z) referenced in function "public: bool __thiscall QtLocalPeer::sendMessage(class QString const &,int)" (?sendMessage@QtLocalPeer@@QAE_NABVQString@@H@Z)
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual bool __thiscall QLocalSocket::waitForBytesWritten(int)" (_imp?waitForBytesWritten@QLocalSocket@@UAE_NH@Z) referenced in function "public: bool __thiscall QtLocalPeer::sendMessage(class QString const &,int)" (?sendMessage@QtLocalPeer@@QAE_NABVQString@@H@Z)
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QLocalSocket::~QLocalSocket(void)" (_imp??1QLocalSocket@@UAE@XZ) referenced in function "public: bool __thiscall QtLocalPeer::sendMessage(class QString const &,int)" (?sendMessage@QtLocalPeer@@QAE_NABVQString@@H@Z)
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QLocalSocket::waitForConnected(int)" (_imp?waitForConnected@QLocalSocket@@QAE_NH@Z) referenced in function "public: bool __thiscall QtLocalPeer::sendMessage(class QString const &,int)" (?sendMessage@QtLocalPeer@@QAE_NABVQString@@H@Z)
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QLocalSocket::connectToServer(class QString const &,class QFlags<enum QIODevice::OpenModeFlag>)" (_imp?connectToServer@QLocalSocket@@QAEXABVQString@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z) referenced in function "public: bool __thiscall QtLocalPeer::sendMessage(class QString const &,int)" (?sendMessage@QtLocalPeer@@QAE_NABVQString@@H@Z)
1>qtlocalpeer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QLocalSocket::QLocalSocket(class QObject *)" (_imp??0QLocalSocket@@QAE@PAVQObject@@@Z) referenced in function "public: bool __thiscall QtLocalPeer::sendMessage(class QString const &,int)" (?sendMessage@QtLocalPeer@@QAE_NABVQString@@H@Z)
1>D:\Projects\test\test\Debug\test.exe : fatal error LNK1120: 16 unresolved externals@ -
but if i add just "qtsingleapplication" I have next errors:
@1>Linking...
1>qtsingleapplication.obj : error LNK2019: unresolved external symbol "public: __thiscall QtLocalPeer::QtLocalPeer(class QObject *,class QString const &)" (??0QtLocalPeer@@QAE@PAVQObject@@ABVQString@@@Z) referenced in function "private: void __thiscall QtSingleApplication::sysInit(class QString const &)" (?sysInit@QtSingleApplication@@AAEXABVQString@@@Z)
1>qtsingleapplication.obj : error LNK2019: unresolved external symbol "public: bool __thiscall QtLocalPeer::isClient(void)" (?isClient@QtLocalPeer@@QAE_NXZ) referenced in function "public: bool __thiscall QtSingleApplication::isRunning(void)" (?isRunning@QtSingleApplication@@QAE_NXZ)
1>qtsingleapplication.obj : error LNK2019: unresolved external symbol "public: bool __thiscall QtLocalPeer::sendMessage(class QString const &,int)" (?sendMessage@QtLocalPeer@@QAE_NABVQString@@H@Z) referenced in function "public: bool __thiscall QtSingleApplication::sendMessage(class QString const &,int)" (?sendMessage@QtSingleApplication@@QAE_NABVQString@@H@Z)
1>D:\Projects\test\test\Debug\test.exe : fatal error LNK1120: 3 unresolved externals@ -
You mean, I need compile QtSolutions like lib, and than add this lib to my project?
-
Watch out for licensing issues though. AFAIK, Qt solutions is under the LGPL and therefore if you include it directly in your code, it has to be an open source app.
-
It's still that way (at least if your license agreement includes the Qt Solutions). BTW, for everybody that doesn't know, the Qt Solutions archive is located at ftp://ftp.qt.nokia.com/qt/solutions/ !
-
Thx, a lot for the help!
I'm compile source like lib and dll than add them to project and include headers to project.