qttest problem: unresolved external symbol
Verfasst: 11. April 2007 03:59
war heute positiv überrascht zu bemerken dass qt auch eine testlib zur verfügung stellt nur krieg ich sie irgendwie nicht zu laufen, QVERIFY und QCOMPARE haben bei mir probleme. ich habe versucht das testbeispiel von QT zu kompilieren (einmal mit nmake (msvc 2005) und mit mingw32) und es bringt immer Fehlermeldungen:
bei compare:
bei compare:
bzw bei qverify:main.obj : error LNK2019: unresolved external symbol "bool __cdecl QTest::compare_helper(bool,char const *,char *,char *,char const *,char const *,char const *,int)" (?compare_helper@QTest@@YA_N_NPBDPAD2111H@Z) referenced in function "bool __cdecl QTest::qCompare<class QString>(class QString const &,class QString const &,char const *,char const *,char const *,int)" (??$qCompare@VQString@@@QTest@@YA_NABVQString@@0PBD11H@Z)
main.obj : error LNK2019: unresolved external symbol "bool __cdecl QTest::compare_helper(bool,char const *,char const *,int)" (?compare_helper@QTest@@YA_N_NPBD1H@Z) referenced in function "bool __cdecl QTest::qCompare<class QString>(class QString const &,class QString const &,char const *,char const *,char const *,int)" (??$qCompare@VQString@@@QTest@@YA_NABVQString@@0PBD11H@Z)
hier der verwendete code:main.obj : error LNK2019: unresolved external symbol "bool __cdecl QTest::qVerify(bool,char const *,char const *,char const *,int)" (?qVerify@QTest@@YA_N_NPBD11H@Z) referenced in function "private: void __thiscall TestQString::toUpper(void)" (?toUpper@TestQString@@AAEXXZ)
Code: Alles auswählen
/****************************************************************************
**
** Copyright (C) 2005-2006 Trolltech ASA. All rights reserved.
**
** This file is part of the documentation of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License version 2.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of
** this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
** http://www.trolltech.com/products/qt/opensource.html
**
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://www.trolltech.com/products/qt/licensing.html or contact the
** sales department at sales@trolltech.com.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include <QtTest/QtTest>
class TestQString: public QObject
{
Q_OBJECT
private slots:
void toUpper();
};
void TestQString::toUpper()
{
QString str = "Hello";
QVERIFY(str.toUpper() == QString("HELLO"));
}