• 13305阅读
  • 10回复

使用 visual 。net 2003 编译 qt 程序,总是提示链接错误? [复制链接]

上一主题 下一主题
离线berlin
 

只看楼主 倒序阅读 楼主  发表于: 2006-09-29
使用 visual 。net 2003 编译 qt 程序,总是提示链接错误?
— 本帖被 XChinux 从 Qt for Linux/X11 移动到本区(2010-02-08) —
我使用的是visual 2003。net 编译一个带qt 的程序。用的是别人的代码。 但是链接的时候总是错误。我网上查了一下,没有找到具体解决办法。 希望各位能指教一下。

------ Build started: Project: OpenMesh_Apps_Decimating, Configuration: Debug Win32 ------

Linking...
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall ProgViewerWidget::qt_property(int,int,class QVariant *)" (?qt_property@ProgViewerWidget@@UAE_NHHPAVQVariant@@@Z)
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall ProgViewerWidget::qt_emit(int,struct QUObject *)" (?qt_emit@ProgViewerWidget@@UAE_NHPAUQUObject@@@Z)
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall ProgViewerWidget::qt_invoke(int,struct QUObject *)" (?qt_invoke@ProgViewerWidget@@UAE_NHPAUQUObject@@@Z)
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall ProgViewerWidget::qt_cast(char const *)" (?qt_cast@ProgViewerWidget@@UAEPAXPBD@Z)
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall ProgViewerWidget::className(void)const " (?className@ProgViewerWidget@@UBEPBDXZ)
progviewer.obj : error LNK2019: unresolved external symbol "public: static class QMetaObject * __cdecl ProgViewerWidget::staticMetaObject(void)" (?staticMetaObject@ProgViewerWidget@@SAPAVQMetaObject@@XZ) referenced in function "public: virtual class QMetaObject * __thiscall ProgViewerWidget::metaObject(void)const " (?metaObject@ProgViewerWidget@@UBEPAVQMetaObject@@XZ)
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_property(int,int,class QVariant *)" (?qt_property@QGLViewerWidget@@UAE_NHHPAVQVariant@@@Z)
QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_property(int,int,class QVariant *)" (?qt_property@QGLViewerWidget@@UAE_NHHPAVQVariant@@@Z)
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_emit(int,struct QUObject *)" (?qt_emit@QGLViewerWidget@@UAE_NHPAUQUObject@@@Z)
QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_emit(int,struct QUObject *)" (?qt_emit@QGLViewerWidget@@UAE_NHPAUQUObject@@@Z)
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_invoke(int,struct QUObject *)" (?qt_invoke@QGLViewerWidget@@UAE_NHPAUQUObject@@@Z)
QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QGLViewerWidget::qt_invoke(int,struct QUObject *)" (?qt_invoke@QGLViewerWidget@@UAE_NHPAUQUObject@@@Z)
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QGLViewerWidget::qt_cast(char const *)" (?qt_cast@QGLViewerWidget@@UAEPAXPBD@Z)
QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QGLViewerWidget::qt_cast(char const *)" (?qt_cast@QGLViewerWidget@@UAEPAXPBD@Z)
progviewer.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall QGLViewerWidget::className(void)const " (?className@QGLViewerWidget@@UBEPBDXZ)
QGLViewerWidget.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall QGLViewerWidget::className(void)const " (?className@QGLViewerWidget@@UBEPBDXZ)
progviewer.obj : error LNK2019: unresolved external symbol "public: static class QMetaObject * __cdecl QGLViewerWidget::staticMetaObject(void)" (?staticMetaObject@QGLViewerWidget@@SAPAVQMetaObject@@XZ) referenced in function "public: virtual class QMetaObject * __thiscall QGLViewerWidget::metaObject(void)const " (?metaObject@QGLViewerWidget@@UBEPAVQMetaObject@@XZ)
QGLViewerWidget.obj : error LNK2019: unresolved external symbol "public: static class QMetaObject * __cdecl QGLViewerWidget::staticMetaObject(void)" (?staticMetaObject@QGLViewerWidget@@SAPAVQMetaObject@@XZ) referenced in function "protected: double __thiscall QGLViewerWidget::performance(void)" (?performance@QGLViewerWidget@@IAENXZ)
Debug/Decimating.exe : fatal error LNK1120: 12 unresolved externals

Build log was saved at "file://d:\My Documents\Software\OpenMesh_1.9.3\OpenMesh\Apps\Decimating\Debug\BuildLog.htm"
OpenMesh_Apps_Decimating - 19 error(s), 0 warning(s)


---------------------- Done ----------------------

  Build: 0 succeeded, 1 failed, 0 skipped
[ 此贴被XChinux在2006-10-09 13:05重新编辑 ]
离线浪漫天使
只看该作者 1楼 发表于: 2006-09-30
可能是你没有生成moc_*.cpp之类的文件,连接出错的函数都是在那些文件里面的,建议你清除后再重新生成一下看看
离线china-wei

只看该作者 2楼 发表于: 2006-12-26
。net2003中编译器选项的环境 路径设置拉没
离线logan319

只看该作者 3楼 发表于: 2007-01-07
我也出现同样的问题!我用的是MSVC2005 standard edition + qt4.2.1, 在链接时出现很多的
“无法解析的外部符号”,各种路径变量都设置好的,不知道是什么原因?会不会我的qt版本太高了?
是不是这个qt根本就不支持MSVC2005 standard edition呢?
离线yanhucheng

只看该作者 4楼 发表于: 2007-04-13
在:项目-->属性-->链接器-->输入-->附加依赖项中添加以下三个库:Imm32.lib;Ws2_32.lib;winmm.lib
离线liujianboy
只看该作者 5楼 发表于: 2007-04-28
引用第4楼yanhucheng于2007-04-13 11:47发表的  :
在:项目-->属性-->链接器-->输入-->附加依赖项中添加以下三个库:Imm32.lib;Ws2_32.lib;winmm.lib


没用呢
离线rock
只看该作者 6楼 发表于: 2007-05-17
这个问题我也遇到了,目前正在解决,折腾了好多天,感觉已经追踪到了根源
离线cavendish

只看该作者 7楼 发表于: 2007-05-25
可以试试这个

  1. @echo off
  2. rem
  3. rem This file is generated
  4. rem
  5. echo Setting up a Qt environment...
  6. echo -- QTDIR set to D:\Qt\4.3.0rc1
  7. echo -- Added D:\Qt\4.3.0rc1\bin to PATH
  8. echo -- QMAKESPEC set to win32-msvc2005
  9. set QTDIR=D:\liangqi\qt\Qt\4.3.0rc1
  10. set PATH=D:\liangqi\qt\Qt\4.3.0rc1\bin;%PATH%
  11. set QMAKESPEC=win32-msvc2005
  12. regedit /e S$D$K$ "HKEY_LOCAL_MACHINE\Software\Microsoft\MicrosoftSDK"
  13. if not exist S$D$K$ goto ENDSDK\r
  14. find "Install Dir" < S$D$K$ > D$I$R$
  15. del S$D$K$
  16. for /f "tokens=2 delims==" %%i in (D$I$R$) do call %%i\setenv
  17. del D$I$R$
  18. :ENDSDK\r
  19. if not "%1"=="vsvars" goto END
  20. call "c:\Program Files\Microsoft Visual Studio 8\\Common7\Tools\vsvars32.bat"
  21. :END
  22. if not "%1"=="vsstart" goto ENDSTARTVS
  23. call "c:\Program Files\Microsoft Visual Studio 8\\Common7\Tools\vsvars32.bat"
  24. VCExpress /useenv
  25. :ENDSTARTVS
离线米尔利安

只看该作者 8楼 发表于: 2008-05-23
顶起来……我清除了文件后还是同样的问题……
我们在天上的父,愿人都尊你的名为圣。
愿你的国降临。
愿你的旨意行在地上,如同行在天上。
离线yutianxing
只看该作者 9楼 发表于: 2009-05-26
引用第6楼rock于2007-05-17 23:27发表的  :
这个问题我也遇到了,目前正在解决,折腾了好多天,感觉已经追踪到了根源




找到根源后共享呀!
离线wd007

只看该作者 10楼 发表于: 2009-12-22
在VS中设置环境变量
欢迎访问我的博客,一起学习提高
http://blog.csdn.net/qter_wd007
快速回复
限100 字节
 
上一个 下一个