[SOLVED] QtSingleApplication
-
wrote on 1 Aug 2011, 13:47 last edited by
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();
}@ -
wrote on 1 Aug 2011, 13:51 last edited by
You did not add the QtSingleApplication.cpp and .h source file to your project.
It is not part of QtGui! -
wrote on 1 Aug 2011, 13:55 last edited by
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@ -
wrote on 1 Aug 2011, 14:00 last edited by
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@ -
wrote on 1 Aug 2011, 14:03 last edited by
you need all of them, but you should check, whther there are some import/export statements. If yes and you add them to your exe, remove them.
-
wrote on 1 Aug 2011, 14:08 last edited by
Seems like you forgot add library to LIBS var in your .pro file
-
wrote on 1 Aug 2011, 15:50 last edited by
In which library should QtSingleApplication be located? AFAIK it is part of the old Qt solutions, which you get as source. You can add it to a library or put the sources directly to your app.
-
wrote on 2 Aug 2011, 08:03 last edited by
You mean, I need compile QtSolutions like lib, and than add this lib to my project?
-
wrote on 2 Aug 2011, 08:20 last edited by
Or add the files to your sources and remove the dllexport/import statements in front of the classes
-
wrote on 2 Aug 2011, 08:29 last edited by
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.
-
wrote on 2 Aug 2011, 08:39 last edited by
I don't know how it is now, but some time ago, it was the same license as Qt itself, so if you have a commercial license, it was commercial, etc....
-
wrote on 2 Aug 2011, 12:53 last edited by
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/ !
-
wrote on 3 Aug 2011, 07:32 last edited by
Thx, a lot for the help!
I'm compile source like lib and dll than add them to project and include headers to project.
8/13