1
我一直在努力讓Qt工作(QCreator,QIde,現在VS2008)。Qt鏈接器錯誤
我已經整理出了大量的問題,但我現在面臨着以下的構建錯誤,並坦率地說,我超出了想法。
Error 1 error LNK2019: unresolved external symbol "public: void __thiscall FileVisitor::processFileList(class QStringList)" ([email protected]@@[email protected]@@Z) referenced in function _main codevisitor-test.obj Question1
Error 2 error LNK2019: unresolved external symbol "public: void __thiscall FileVisitor::processEntry(class QString)" ([email protected]@@[email protected]@@Z) referenced in function _main codevisitor-test.obj Question1
Error 3 error LNK2019: unresolved external symbol "public: class QString __thiscall ArgumentList::getSwitchArg(class QString,class QString)" ([email protected]@@[email protected]@[email protected]@Z) referenced in function _main codevisitor-test.obj Question1
Error 4 error LNK2019: unresolved external symbol "public: bool __thiscall ArgumentList::getSwitch(class QString)" ([email protected]@@[email protected]@@Z) referenced in function _main codevisitor-test.obj Question1
Error 5 error LNK2019: unresolved external symbol "public: void __thiscall ArgumentList::argsToStringlist(int,char * * const)" ([email protected]@@[email protected]) referenced in function "public: __thiscall ArgumentList::ArgumentList(int,char * * const)" ([email protected]@[email protected]@Z) codevisitor-test.obj Question1
Error 6 error LNK2019: unresolved external symbol "public: __thiscall FileVisitor::FileVisitor(class QString,bool,bool)" ([email protected]@[email protected]@@[email protected]) referenced in function "public: __thiscall CodeVisitor::CodeVisitor(class QString,bool)" ([email protected]@[email protected]@@[email protected]) codevisitor-test.obj Question1
Error 7 error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall FileVisitor::metaObject(void)const " ([email protected]@@[email protected]@XZ) codevisitor-test.obj Question1
Error 8 error LNK2001: unresolved external symbol "public: virtual void * __thiscall FileVisitor::qt_metacast(char const *)" ([email protected]@@[email protected]) codevisitor-test.obj Question1
Error 9 error LNK2001: unresolved external symbol "public: virtual int __thiscall FileVisitor::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected]) codevisitor-test.obj Question1
Error 10 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall FileVisitor::skipDir(class QDir const &)" ([email protected]@@[email protected]@@Z) codevisitor-test.obj Question1
Error 11 fatal error LNK1120: 10 unresolved externals ... \Visual Studio 2008\Projects\Assignment1\Question1\Question1\Debug\Question1.exe Question1
的代碼如下:提前
#include "argumentlist.h"
#include <codevisitor.h>
#include <QDebug>
void usage(QString appname) {
qDebug() << appname << " Usage: \n"
<< "codevisitor [-r] [-d startdir] [-f filter] [file-list]\n"
<< "\t-r \tvisitor will recurse into subdirs\n"
<< "\t-d startdir\tspecifies starting directory\n"
<< "\t-f filter\tfilename filter to restrict visits\n"
<< "\toptional list of files to be visited";
}
int main(int argc, char** argv) {
ArgumentList al(argc, argv);
QString appname = al.takeFirst(); /* app name is always first in the list. */
if (al.count() == 0) {
usage(appname);
exit(1);
}
bool recursive(al.getSwitch("-r"));
QString startdir(al.getSwitchArg("-d"));
QString filter(al.getSwitchArg("-f"));
CodeVisitor cvis(filter, recursive);
if (startdir != QString()) {
cvis.processEntry(startdir);
}
else if (al.size()) {
cvis.processFileList(al);
}
else
return 1;
qDebug() << "Files Processed: %d" << cvis.getNumFiles();
qDebug() << cvis.getResultString();
return 0;
}
謝謝,我只是難倒。
從來沒有與qt合作,但看起來像缺少一些庫包括。 – 2010-05-01 15:40:00