• 13100阅读
  • 3回复

在重新编译QT4.1的例子程序dombookmarks时遇到问题! [复制链接]

上一主题 下一主题
离线dyzlj1984
 
只看楼主 倒序阅读 楼主  发表于: 2006-03-29
最近对Qt的Xml解析很有兴趣,但是当我那QT的示例程序dombookmarks编译的时候老是出错,VS.net 2003老是提示下面的信息:
e:\my documents\Visual Studio Projects\qttest\xbeltree.h fatal error C1083: 无法打开包含文件:“QDomDocument”: No such file or directory

说明一下,我已经把示例的除了源文件的其他文件删除,就剩下.cpp和.h文件

我的环境变量应该是正确的,因为在编译其他例子的时候都没有遇到问题,就是编译这个例子遇到了问题。我察看了QT的include目录下,确实有QtXml这个目录,里面也确实有QdomDocument这个文件,不应该include 不进去的啊,请各位大哥大姐指点。感激不尽!

离线dyzlj1984
只看该作者 1楼 发表于: 2006-03-29
include的问题已经解决
方法是使用这一句:
#include <QtXml\QDomDocument>

但是新的问题又来了:

正在生成代码...

    cl -c -nologo -Zm200 -Zi -MDd -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DU
NICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_T
HREAD_SUPPORT -I"D:/Qt/4.1.0/include/QtCore" -I"D:/Qt/4.1.0/include/QtGui" -I"D:
/Qt/4.1.0/include" -I"." -I"D:/Qt/4.1.0/include/ActiveQt" -I"debug" -I"." -I"D:/
Qt/4.1.0/mkspecs/win32-msvc.net" -Fodebug\ @C:\DOCUME~1\君临天下\LOCALS~1\Temp\n
mBB.tmp
moc_xbeltree.cpp
    link /LIBPATH:"D:\Qt\4.1.0\lib" /NOLOGO /DEBUG /DEBUG /SUBSYSTEM:WINDOWS
/OUT:"debug\dombookmarks.exe" @C:\DOCUME~1\君临天下\LOCALS~1\Temp\nmBC.tmp
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
__thiscall QDomDocument::~QDomDocument(void)" (__imp_??1QDomDocument@@QAE@XZ) ,
该符号在函数 $L70035 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
__thiscall QDomDocument::QDomDocument(void)" (__imp_??0QDomDocument@@QAE@XZ) ,
该符号在函数 "public: __thiscall XbelTree::XbelTree(class QWidget *)" (??0XbelTr
ee@@QAE@PAVQWidget@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QDomElement & __thiscall QDomElement::operator=(class QDomElement const &)
" (__imp_??4QDomElement@@QAEAAV0@ABV0@@Z) ,该符号在函数 "public: bool __thiscal
l XbelTree::read(class QIODevice *)" (?read@XbelTree@@QAE_NPAVQIODevice@@@Z) 中
被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QDomElement __thiscall QDomNode::nextSiblingElement(class QString const &)
const " (__imp_?nextSiblingElement@QDomNode@@QBE?AVQDomElement@@ABVQString@@@Z)
,该符号在函数 "public: bool __thiscall XbelTree::read(class QIODevice *)" (?rea
d@XbelTree@@QAE_NPAVQIODevice@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
bool __thiscall QDomNode::isNull(void)const " (__imp_?isNull@QDomNode@@QBE_NXZ)
,该符号在函数 "public: bool __thiscall XbelTree::read(class QIODevice *)" (?rea
d@XbelTree@@QAE_NPAVQIODevice@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QDomElement __thiscall QDomNode::firstChildElement(class QString const &)c
onst " (__imp_?firstChildElement@QDomNode@@QBE?AVQDomElement@@ABVQString@@@Z) ,
该符号在函数 "public: bool __thiscall XbelTree::read(class QIODevice *)" (?read@
XbelTree@@QAE_NPAVQIODevice@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QString __thiscall QDomElement::attribute(class QString const &,class QStr
ing const &)const " (__imp_?attribute@QDomElement@@QBE?AVQString@@ABV2@0@Z) ,该
符号在函数 "public: bool __thiscall XbelTree::read(class QIODevice *)" (?read@Xb
elTree@@QAE_NPAVQIODevice@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
bool __thiscall QDomElement::hasAttribute(class QString const &)const " (__imp_?
hasAttribute@QDomElement@@QBE_NABVQString@@@Z) ,该符号在函数 "public: bool __th
iscall XbelTree::read(class QIODevice *)" (?read@XbelTree@@QAE_NPAVQIODevice@@@Z
) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
__thiscall QDomElement::~QDomElement(void)" (__imp_??1QDomElement@@QAE@XZ) ,该
符号在函数 "public: bool __thiscall XbelTree::read(class QIODevice *)" (?read@Xb
elTree@@QAE_NPAVQIODevice@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QString __thiscall QDomElement::tagName(void)const " (__imp_?tagName@QDomE
lement@@QBE?AVQString@@XZ) ,该符号在函数 "public: bool __thiscall XbelTree::rea
d(class QIODevice *)" (?read@XbelTree@@QAE_NPAVQIODevice@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QDomElement __thiscall QDomDocument::documentElement(void)const " (__imp_?
documentElement@QDomDocument@@QBE?AVQDomElement@@XZ) ,该符号在函数 "public: boo
l __thiscall XbelTree::read(class QIODevice *)" (?read@XbelTree@@QAE_NPAVQIODevi
ce@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
bool __thiscall QDomDocument::setContent(class QIODevice *,bool,class QString *,
int *,int *)" (__imp_?setContent@QDomDocument@@QAE_NPAVQIODevice@@_NPAVQString@@
PAH3@Z) ,该符号在函数 "public: bool __thiscall XbelTree::read(class QIODevice *
)" (?read@XbelTree@@QAE_NPAVQIODevice@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
void __thiscall QDomNode::save(class QTextStream &,int)const " (__imp_?save@QDom
Node@@QBEXAAVQTextStream@@H@Z) ,该符号在函数 "public: bool __thiscall XbelTree:
:write(class QIODevice *)" (?write@XbelTree@@QAE_NPAVQIODevice@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
void __thiscall QDomElement::setAttribute(class QString const &,class QString co
nst &)" (__imp_?setAttribute@QDomElement@@QAEXABVQString@@0@Z) ,该符号在函数 "p
rivate: void __thiscall XbelTree::updateDomElement(class QTreeWidgetItem *,int)"
(?updateDomElement@XbelTree@@AAEXPAVQTreeWidgetItem@@H@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
__thiscall QDomText::~QDomText(void)" (__imp_??1QDomText@@QAE@XZ) ,该符号在函数
"private: void __thiscall XbelTree::updateDomElement(class QTreeWidgetItem *,in
t)" (?updateDomElement@XbelTree@@AAEXPAVQTreeWidgetItem@@H@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QDomNode __thiscall QDomNode::replaceChild(class QDomNode const &,class QD
omNode const &)" (__imp_?replaceChild@QDomNode@@QAE?AV1@ABV1@0@Z) ,该符号在函数
"private: void __thiscall XbelTree::updateDomElement(class QTreeWidgetItem *,in
t)" (?updateDomElement@XbelTree@@AAEXPAVQTreeWidgetItem@@H@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
__thiscall QDomNode::~QDomNode(void)" (__imp_??1QDomNode@@QAE@XZ) ,该符号在函数
"private: void __thiscall XbelTree::updateDomElement(class QTreeWidgetItem *,in
t)" (?updateDomElement@XbelTree@@AAEXPAVQTreeWidgetItem@@H@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QDomNode __thiscall QDomNode::appendChild(class QDomNode const &)" (__imp_
?appendChild@QDomNode@@QAE?AV1@ABV1@@Z) ,该符号在函数 "private: void __thiscall
XbelTree::updateDomElement(class QTreeWidgetItem *,int)" (?updateDomElement@Xbe
lTree@@AAEXPAVQTreeWidgetItem@@H@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QDomText __thiscall QDomDocument::createTextNode(class QString const &)" (
__imp_?createTextNode@QDomDocument@@QAE?AVQDomText@@ABVQString@@@Z) ,该符号在函
数 "private: void __thiscall XbelTree::updateDomElement(class QTreeWidgetItem *,
int)" (?updateDomElement@XbelTree@@AAEXPAVQTreeWidgetItem@@H@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QDomElement __thiscall QDomDocument::createElement(class QString const &)"
(__imp_?createElement@QDomDocument@@QAE?AVQDomElement@@ABVQString@@@Z) ,该符号
在函数 "private: void __thiscall XbelTree::updateDomElement(class QTreeWidgetIte
m *,int)" (?updateDomElement@XbelTree@@AAEXPAVQTreeWidgetItem@@H@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
class QString __thiscall QDomElement::text(void)const " (__imp_?text@QDomElement
@@QBE?AVQString@@XZ) ,该符号在函数 "private: void __thiscall XbelTree::parseFol
derElement(class QDomElement const &,class QTreeWidgetItem *)" (?parseFolderElem
ent@XbelTree@@AAEXABVQDomElement@@PAVQTreeWidgetItem@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
__thiscall QDomElement::QDomElement(class QDomElement const &)" (__imp_??0QDomEl
ement@@QAE@ABV0@@Z) ,该符号在函数 "public: class QDomElement const __thiscall Q
Hash<class QTreeWidgetItem *,class QDomElement>::value(class QTreeWidgetItem * c
onst &)const " (?value@?$QHash@PAVQTreeWidgetItem@@VQDomElement@@@@QBE?BVQDomEle
ment@@ABQAVQTreeWidgetItem@@@Z) 中被引用
xbeltree.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
__thiscall QDomElement::QDomElement(void)" (__imp_??0QDomElement@@QAE@XZ) ,该符
号在函数 "public: class QDomElement const __thiscall QHash<class QTreeWidgetItem
*,class QDomElement>::value(class QTreeWidgetItem * const &)const " (?value@?$Q
Hash@PAVQTreeWidgetItem@@VQDomElement@@@@QBE?BVQDomElement@@ABQAVQTreeWidgetItem
@@@Z) 中被引用
debug\dombookmarks.exe : fatal error LNK1120: 23 个无法解析的外部命令
NMAKE : fatal error U1077: “link” : 返回代码“0x460”
Stop.
NMAKE : fatal error U1077: “"D:\Program Files\Microsoft Visual Studio .NET 2003
\VC7\BIN\nmake.exe"” : 返回代码“0x2”
Stop.
离线kotao_78

只看该作者 2楼 发表于: 2006-08-10
I've encountered same problem like you.

it will return error as following,

g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.1.3/lib -o qxmp aboutdialog.o bookmarkdialog.o configdialog.o main.o playerbutton.o playlistdialog.o playlisturldialog.o qxmp.o titlearea.o urldialog.o moc_aboutdialog.o moc_bookmarkdialog.o moc_configdialog.o moc_playerbutton.o moc_playlistdialog.o moc_playlisturldialog.o moc_qxmp.o moc_titlearea.o moc_urldialog.o qrc_qxmp.o   -L/usr/local/Trolltech/Qt-4.1.3/lib -lQtGui_debug -L/root/Download/qt-x11-opensource-src-4.1.3/lib -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore_debug -lz -lm -ldl -lpthread
qxmp.o: In function `qxmp::load(QString)':/root/Project/qxmp/qxmp.cpp:234: undefined reference to `QDomDocument::QDomDocument()'
:/root/Project/qxmp/qxmp.cpp:235: undefined reference to `QDomElement::QDomElement()'
:/root/Project/qxmp/qxmp.cpp:235: undefined reference to `QDomElement::QDomElement()'
:/root/Project/qxmp/qxmp.cpp:236: undefined reference to `QDomNode::QDomNode()'
:/root/Project/qxmp/qxmp.cpp:236: undefined reference to `QDomNode::QDomNode()'
:/root/Project/qxmp/qxmp.cpp:237: undefined reference to `QDomNodeList::QDomNodeList()'
:/root/Project/qxmp/qxmp.cpp:381: undefined reference to `QDomDocument::setContent(QIODevice*, QString*, int*, int*)'
:/root/Project/qxmp/qxmp.cpp:391: undefined reference to `QDomDocument::documentElement() const'
:/root/Project/qxmp/qxmp.cpp:391: undefined reference to `QDomElement::operator=(QDomElement const&)'
:/root/Project/qxmp/qxmp.cpp:392: undefined reference to `QDomNode::firstChild() const'
:/root/Project/qxmp/qxmp.cpp:392: undefined reference to `QDomNode::operator=(QDomNode const&)'
:/root/Project/qxmp/qxmp.cpp:392: undefined reference to `QDomNode::~QDomNode()'
:/root/Project/qxmp/qxmp.cpp:392: undefined reference to `QDomNode::~QDomNode()'
离线ericguo
只看该作者 3楼 发表于: 2006-08-12
确认在qmake -project生成的*.pro文件内有:
  QT += xml

奇怪的是,这个例子应该已经提供了pro文件啊?,如果还有问题,确定link程序可以找到QtXML的库文件
快速回复
限100 字节
 
上一个 下一个