gpt4 book ai didi

c++ - 在带有 VS 2008 的 Qt 4.8.5 网络示例中找不到 ui_chatdialog.h

转载 作者:行者123 更新时间:2023-11-28 03:11:02 26 4
gpt4 key购买 nike

我刚开始使用 Qt 进行开发,我希望编译 Qt 4.8.5 附带的 Qt 网络聊天示例:http://qt-project.org/doc/qt-4.8/network-network-chat.html

我在 VS 2012 中工作,但使用 VS 2008 进行编译。我有以下内容:

C:\Qt\4.8.5\include\Qt;
C:\Qt\4.8.5\include\QtUiTools;
C:\Qt\4.8.5\include;
C:\Qt\4.8.5\include\QtCore;
C:\Qt\4.8.5\include\QtGui;
C:\Qt\4.8.5\include\QtNetwork;
%(AdditionalIncludeDirectories)

我觉得我在编译过程中遗漏了一些步骤,也许是生成 ui_chatdialog.h 文件的步骤?我无法弄清楚为什么示例中缺少它,并且它不存在于我下载的 Qt 版本 (4.8.5) 附带的文件中。

这是我当前的输出:

>------ Rebuild All started: Project: QTChatExample, Configuration: Release Win32 ------
1> chatdialog.cpp
1>c:\users\dustin\documents\qtchatexample\src\chatdialog.h(44): fatal error C1083: Cannot open include file: 'ui_chatdialog.h': No such file or directory
1> client.cpp
1> connection.cpp
1> main.cpp
1>c:\users\dustin\documents\qtchatexample\src\chatdialog.h(44): fatal error C1083: Cannot open include file: 'ui_chatdialog.h': No such file or directory
1> peermanager.cpp
1> server.cpp
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

最佳答案

您需要运行 uic 来为您的 ui 文件生成头文件

http://qt-project.org/doc/qt-4.8/uic.html

而且您还需要 moc 来为信号和槽之类的东西生成源元对象代码。

http://qt-project.org/doc/qt-4.8/metaobjects.html

执行此操作的一种方法是使用适用于 Visual Studio 的 Qt 插件。尽管您可以创建一个自定义构建步骤来执行 moc、uic 和资源编译器,或者使用 QMake 或 CMake,它们也会为您执行这些。

http://qt-project.org/faq/answer/what_is_the_qt_visual_studio_add-in

因为你也为 VS2012 标记了这个问题,我将添加以下内容:

Is it possible to work with Qt4 projects in Visual Studio 2012 using add-ins?

关于c++ - 在带有 VS 2008 的 Qt 4.8.5 网络示例中找不到 ui_chatdialog.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18497327/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com