May 8, 2012

chikuba chikuba
Lab Rat
11 posts

Trouble building QtMock in visual studio, linking errors

 

Hi

Just downloaded the following source code (https://qt.gitorious.org/~niandong/qt/niandongs-qttools/commits/qtmock) and Im trying to build it in VS2010 so that I can link it with my other projects. I can build the qtmock.pro (in the qttestlib/qtmock folder) in QTcreator.

I first imported the qtmock.pro into VS2010 but got too many linking errors. I then decided to only try and build the projects that Im actaully using. I manage to build the qtmock.pro inside the qtmock/src folder with only contains the files for the actual lib (and not all the files and tests etc). I then tried to build the qtnetworkstub.pro project with creates a lib with all the QNetworkAccessManaget and QNetworkReply mocks. This ended up in the following linking error:

  1. Error 4 error LNK2019: unresolved external symbol "public: static struct QMetaObject const QAbstractSocket::staticMetaObject" (?staticMetaObject@QAbstractSocket@@2UQMetaObject@@B) referenced in function "public: __thiscall QNetworkRequest::~QNetworkRequest(void)" (??1QNetworkRequest@@QAE@XZ) E:\src\Qt.UnitTest\qtmock\test\stublib\network\qnetworkrequest.obj qtnetworkstub
  2. Error 5 error LNK2001: unresolved external symbol "public: static struct QMetaObject const QTcpSocket::staticMetaObject" (?staticMetaObject@QTcpSocket@@2UQMetaObject@@B) E:\src\Qt.UnitTest\qtmock\test\stublib\network\qnetworkreply.obj qtnetworkstub
  3. Error 6 error LNK2001: unresolved external symbol "public: static struct QMetaObject const QTcpSocket::staticMetaObject" (?staticMetaObject@QTcpSocket@@2UQMetaObject@@B) E:\src\Qt.UnitTest\qtmock\test\stublib\network\qnetworkrequest.obj qtnetworkstub
  4. Error 7 error LNK2001: unresolved external symbol "public: static struct QMetaObject const QSslSocket::staticMetaObject" (?staticMetaObject@QSslSocket@@2UQMetaObject@@B) E:\src\Qt.UnitTest\qtmock\test\stublib\network\qnetworkreply.obj qtnetworkstub
  5. Error 8 error LNK2001: unresolved external symbol "public: static struct QMetaObject const QSslSocket::staticMetaObject" (?staticMetaObject@QSslSocket@@2UQMetaObject@@B) E:\src\Qt.UnitTest\qtmock\test\stublib\network\qnetworkrequest.obj qtnetworkstub
  6. Error 1 error LNK2001: unresolved external symbol "public: static struct QMetaObject const QAbstractSocket::staticMetaObject" (?staticMetaObject@QAbstractSocket@@2UQMetaObject@@B) E:\src\Qt.UnitTest\qtmock\test\stublib\network\qnetworkaccessmanager.obj qtnetworkstub
  7. Error 2 error LNK2001: unresolved external symbol "public: static struct QMetaObject const QAbstractSocket::staticMetaObject" (?staticMetaObject@QAbstractSocket@@2UQMetaObject@@B) E:\src\Qt.UnitTest\qtmock\test\stublib\network\qnetworkproxy.obj qtnetworkstub
  8. Error 3 error LNK2001: unresolved external symbol "public: static struct QMetaObject const QAbstractSocket::staticMetaObject" (?staticMetaObject@QAbstractSocket@@2UQMetaObject@@B) E:\src\Qt.UnitTest\qtmock\test\stublib\network\qnetworkreply.obj qtnetworkstub
  9. Error 9 error LNK1120: 3 unresolved externals E:\src\Qt.UnitTest\qtmock\lib\\qtnetworkmock.dll qtnetworkstub

I have openSsl installed and it links in my other projects. I havent changed any settings and I is like in the .pro file except a VS2010 project instead with the following command line:

  1. /OUT:"..\..\..\lib\\qtnetworkmock.dll" /NOLOGO /LIBPATH:"E:\QT\4.8.0\lib" /LIBPATH:"e:\QT\4.8.0\lib" /LIBPATH:"../../../lib" /DLL "../../../lib\qtmock.lib" "E:\QT\4.8.0\lib\QtTestd4.lib" "E:\QT\4.8.0\lib\QtCored4.lib" "QtNetworkd4.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Win32\qtnetworkmock.dll.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"E:\.Qt.UnitTest\qtmock\lib\qtnetworkmock.pdb" /PGD:"E:\src\Qt.UnitTest\qtmock\lib\qtnetworkmock.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE

Would really appreciate if anyone would know what the issue is here. Thank you

UPDATE: I tried to look for the objects that it cant link and non of them are refered to in the project

0 replies

 
  ‹‹ Experience with serial interface      [SOLVED] QWT 6.0 library in QT ››

You must log in to post a reply. Not a member yet? Register here!