当前位置: 技术问答>linux和unix
windows下的QT编译问题:链接时提示某些虚函数 unresolved external symbol
来源: 互联网 发布时间:2015-06-22
本文导语: 从QT的中文文档例子中下载的代码,如下: http://www.qiliang.net/qt/tutorial1-08.html 保存完文件后,用: qmake -project -win32 生成了.pro文件, 然后qmake,生成了makefile 然后nmake ,提示: F:Studyt8>nmake Microsoft (R) Program Maintenance...
从QT的中文文档例子中下载的代码,如下:
http://www.qiliang.net/qt/tutorial1-08.html
保存完文件后,用:
qmake -project -win32
生成了.pro文件,
然后qmake,生成了makefile
然后nmake
,提示:
F:Studyt8>nmake
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
link /NOLOGO /SUBSYSTEM:windows /OUT:t8.exe @C:DOCUME~1BrillyLOCALS~1
Tempnma02036.
cannon.obj : error LNK2001: unresolved external symbol "public: virtual bool __t
hiscall CannonField::qt_property(int,int,class QVariant *)" (?qt_property@Cannon
Field@@UAE_NHHPAVQVariant@@@Z)
cannon.obj : error LNK2001: unresolved external symbol "public: virtual bool __t
hiscall CannonField::qt_emit(int,struct QUObject *)" (?qt_emit@CannonField@@UAE_
NHPAUQUObject@@@Z)
cannon.obj : error LNK2001: unresolved external symbol "public: virtual bool __t
hiscall CannonField::qt_invoke(int,struct QUObject *)" (?qt_invoke@CannonField@@
UAE_NHPAUQUObject@@@Z)
cannon.obj : error LNK2001: unresolved external symbol "public: virtual void * _
_thiscall CannonField::qt_cast(char const *)" (?qt_cast@CannonField@@UAEPAXPBD@Z
)
cannon.obj : error LNK2001: unresolved external symbol "public: virtual char con
st * __thiscall CannonField::className(void)const " (?className@CannonField@@UBE
PBDXZ)
cannon.obj : error LNK2001: unresolved external symbol "public: static class QMe
taObject * __cdecl CannonField::staticMetaObject(void)" (?staticMetaObject@Canno
nField@@SAPAVQMetaObject@@XZ)
cannon.obj : error LNK2001: unresolved external symbol "protected: void __thisca
ll CannonField::angleChanged(int)" (?angleChanged@CannonField@@IAEXH@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual bool _
_thiscall LCDRange::qt_property(int,int,class QVariant *)" (?qt_property@LCDRang
e@@UAE_NHHPAVQVariant@@@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual bool _
_thiscall LCDRange::qt_emit(int,struct QUObject *)" (?qt_emit@LCDRange@@UAE_NHPA
UQUObject@@@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual bool _
_thiscall LCDRange::qt_invoke(int,struct QUObject *)" (?qt_invoke@LCDRange@@UAE_
NHPAUQUObject@@@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual void *
__thiscall LCDRange::qt_cast(char const *)" (?qt_cast@LCDRange@@UAEPAXPBD@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual char c
onst * __thiscall LCDRange::className(void)const " (?className@LCDRange@@UBEPBDX
Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: static class Q
MetaObject * __cdecl LCDRange::staticMetaObject(void)" (?staticMetaObject@LCDRan
ge@@SAPAVQMetaObject@@XZ)
t8.exe : fatal error LNK1120: 13 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
环境说明:
windows server 2003
vc6
qt 3.0.1
Directory of C:Qt3.0.1lib
2004-04-27 10:02 .
2004-04-27 10:02 ..
2004-04-27 15:53 82 editor.prl
2004-04-26 15:06 176,128 editor100.dll
2004-04-26 15:06 70,219 editor100.exp
2004-04-26 15:06 117,720 editor100.lib
2004-04-27 15:52 345 qnp.prl
2004-04-27 15:53 138 qt-mt.prl
2004-04-26 15:00 3,543,040 qt-mt301.dll
2004-04-26 14:57 2,792,404 qt-mt301.exp
2004-04-26 14:57 4,624,904 qt-mt301.lib
2004-04-26 15:00 3,543,040 qt-mt301d.dll
2004-04-26 14:57 2,792,404 qt-mt301d.exp
2004-04-26 14:57 4,624,904 qt-mt301d.lib
2004-04-26 15:00 4,104 qtmain.lib
2004-04-27 15:53 304 qtmain.prl
2004-04-26 15:02 571,962 qui.lib
2004-04-27 15:53 318 qui.prl
2004-04-26 14:31 76 README
17 File(s) 22,862,092 bytes
2 Dir(s) 5,306,253,312 bytes free
http://www.qiliang.net/qt/tutorial1-08.html
保存完文件后,用:
qmake -project -win32
生成了.pro文件,
然后qmake,生成了makefile
然后nmake
,提示:
F:Studyt8>nmake
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
link /NOLOGO /SUBSYSTEM:windows /OUT:t8.exe @C:DOCUME~1BrillyLOCALS~1
Tempnma02036.
cannon.obj : error LNK2001: unresolved external symbol "public: virtual bool __t
hiscall CannonField::qt_property(int,int,class QVariant *)" (?qt_property@Cannon
Field@@UAE_NHHPAVQVariant@@@Z)
cannon.obj : error LNK2001: unresolved external symbol "public: virtual bool __t
hiscall CannonField::qt_emit(int,struct QUObject *)" (?qt_emit@CannonField@@UAE_
NHPAUQUObject@@@Z)
cannon.obj : error LNK2001: unresolved external symbol "public: virtual bool __t
hiscall CannonField::qt_invoke(int,struct QUObject *)" (?qt_invoke@CannonField@@
UAE_NHPAUQUObject@@@Z)
cannon.obj : error LNK2001: unresolved external symbol "public: virtual void * _
_thiscall CannonField::qt_cast(char const *)" (?qt_cast@CannonField@@UAEPAXPBD@Z
)
cannon.obj : error LNK2001: unresolved external symbol "public: virtual char con
st * __thiscall CannonField::className(void)const " (?className@CannonField@@UBE
PBDXZ)
cannon.obj : error LNK2001: unresolved external symbol "public: static class QMe
taObject * __cdecl CannonField::staticMetaObject(void)" (?staticMetaObject@Canno
nField@@SAPAVQMetaObject@@XZ)
cannon.obj : error LNK2001: unresolved external symbol "protected: void __thisca
ll CannonField::angleChanged(int)" (?angleChanged@CannonField@@IAEXH@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual bool _
_thiscall LCDRange::qt_property(int,int,class QVariant *)" (?qt_property@LCDRang
e@@UAE_NHHPAVQVariant@@@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual bool _
_thiscall LCDRange::qt_emit(int,struct QUObject *)" (?qt_emit@LCDRange@@UAE_NHPA
UQUObject@@@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual bool _
_thiscall LCDRange::qt_invoke(int,struct QUObject *)" (?qt_invoke@LCDRange@@UAE_
NHPAUQUObject@@@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual void *
__thiscall LCDRange::qt_cast(char const *)" (?qt_cast@LCDRange@@UAEPAXPBD@Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: virtual char c
onst * __thiscall LCDRange::className(void)const " (?className@LCDRange@@UBEPBDX
Z)
lcdrange.obj : error LNK2001: unresolved external symbol "public: static class Q
MetaObject * __cdecl LCDRange::staticMetaObject(void)" (?staticMetaObject@LCDRan
ge@@SAPAVQMetaObject@@XZ)
t8.exe : fatal error LNK1120: 13 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
环境说明:
windows server 2003
vc6
qt 3.0.1
Directory of C:Qt3.0.1lib
2004-04-27 10:02 .
2004-04-27 10:02 ..
2004-04-27 15:53 82 editor.prl
2004-04-26 15:06 176,128 editor100.dll
2004-04-26 15:06 70,219 editor100.exp
2004-04-26 15:06 117,720 editor100.lib
2004-04-27 15:52 345 qnp.prl
2004-04-27 15:53 138 qt-mt.prl
2004-04-26 15:00 3,543,040 qt-mt301.dll
2004-04-26 14:57 2,792,404 qt-mt301.exp
2004-04-26 14:57 4,624,904 qt-mt301.lib
2004-04-26 15:00 3,543,040 qt-mt301d.dll
2004-04-26 14:57 2,792,404 qt-mt301d.exp
2004-04-26 14:57 4,624,904 qt-mt301d.lib
2004-04-26 15:00 4,104 qtmain.lib
2004-04-27 15:53 304 qtmain.prl
2004-04-26 15:02 571,962 qui.lib
2004-04-27 15:53 318 qui.prl
2004-04-26 14:31 76 README
17 File(s) 22,862,092 bytes
2 Dir(s) 5,306,253,312 bytes free
|
写的太多了, 你生成的工程文件里没有加上你所要的库和头文件, 那肯定有在量的错误和警告的,
你可以用下用的命令生成VC的工程文件, 再在VC里面去改那就容易多了
qmake -t vcapp -o aa.dsp aa.pro
再用VC打开这个aa.dsp, 然后把一些必要的路径加上去就可以了
你可以用下用的命令生成VC的工程文件, 再在VC里面去改那就容易多了
qmake -t vcapp -o aa.dsp aa.pro
再用VC打开这个aa.dsp, 然后把一些必要的路径加上去就可以了
|
还有你的版本也太旧了一点, 我现在用的是qt3.2 企业版了.
和vs.net 2003 enterprise
windows server 2003
和vs.net 2003 enterprise
windows server 2003
|
企业版是不能免费得到的, 你可以去买,也可以到其他人那里去弄,
首先申明,我这里是不行的, 这是我们公司买的, 我不能给你
首先申明,我这里是不行的, 这是我们公司买的, 我不能给你