QT Installation for Visual Studio 2005

本文详细介绍如何下载并安装QT SDK,包括设置系统环境变量、配置QT以适应不同编译器及构建过程中的注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、Download QT SDK

 

  Download QT SDK for Windows from the site http://www.qtsoftware.com/downloads

 

2、Install QT SDK

  Install QT SDK for Windows completely(No matter which version)

 

3、Edit System Environment Variables

 

 add 2 paths to the Environment Variables: take "C:/QT/2010.04/qt/bin" and "C:/QT/2010.04/bin"  for example.

 the values of the 2 paths depends on where you install the QT

 

4、Configure QT for your machine

 

 Run the Visual Studio Command Prompt:Start->Program Files->Visual Studio->Visual Studio tools->Visual Studio Command Prompt

Go to the path of your installed QT,eg "C:/QT/2010.04/qt"

At the Prompt,type the command configure ,eg C:/QT/2010.04/qt>configure

If you want to build the QT library using a specific compiler ,you must specify a qmake specification.eg C:/QT/2010.04/qt>configure -platform win32-msvc

then press Enter key to configure it

 

After Configured,run nmake at the command prompt,eg  C:/QT/2010.04/qt>nmake

 

this will takes lots of time.It will build all the demos,examples and libraries.

 

Done!

 

 

 

ps:

if occurs the Error:"fatal error U1077" and so on

You should add "VC-Path/bin"、"VC-Path/include" and "VC-Path/lib" to System Environment Variables

 

VC-Path mens where VC installed.

 

otherwise:

delete these temporary files before Execute "nmake " command

"

/src/3rdparty/webkit/WebCore/tmp/moc/debug_shared/ mocinclude.tmp
/src/3rdparty/webkit/WebCore/tmp/moc/release_shared/mocinclude.tmp
/src/script/tmp/moc/debug_shared/mocinclude.tmp
/src/script/tmp/moc/release_shared/mocinclude.tmp

"

Visual Studio 中安装和配置 Qt 开发环境,可以通过官方推荐的 **Qt Visual Studio Tools** 插件实现。该插件集成了 Qt 设计器、信号与槽机制支持、以及 QMake 和 CMake 构建系统,适合现代 Qt 项目的开发[^2]。 ### 安装 Qt Visual Studio Tools 1. 在 Visual Studio 中,通过菜单栏选择“扩展” > “管理扩展”,搜索并下载适用于当前版本 Visual Studio 的 **Qt Visual Studio Tools** 插件。 2. 安装完成后重启 Visual Studio,确保插件生效[^3]。 ### 配置 Qt 环境 1. 下载并安装 Qt 框架。建议从官网注册账号后下载离线安装包(如 Qt 5.14.2),并选择 64 位编译器进行安装。 2. 将 Qt 安装目录下的 `bin` 路径添加到系统环境变量 `Path` 中,以便命令行工具可以识别 `qmake` 命令。 3. 在 Visual Studio 中打开“Qt VS Tools”菜单,选择“Qt Versions”,设置 Qt 安装路径及对应的编译器版本,确保集成环境正确识别 Qt SDK[^1]。 ### 创建 Qt 工程 1. 在 Visual Studio 中创建一个新的项目,选择“Qt Widgets Application”模板。 2. 配置项目属性时,确保 Qt Installation 设置为已安装的 Qt 版本,并指定正确的构建套件。 3. 使用 Qt Designer 可视化设计界面,编写信号与槽代码实现交互逻辑。 4. 编译并运行项目,验证是否成功显示 Qt 窗口界面[^1]。 ### 示例代码:主窗口初始化 以下是一个典型的 Qt 主窗口类定义示例: ```cpp // mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); }; #endif // MAINWINDOW_H ``` ```cpp // mainwindow.cpp #include "mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle("Qt in Visual Studio"); resize(800, 600); } MainWindow::~MainWindow() { } ``` ```cpp // main.cpp #include <QApplication> #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值