CodeBlocks+MinGW+Qt编译原理

本文介绍如何使用uic、moc及rcc工具从Qt Designer创建的UI文件中生成对应的C++源文件,并将这些文件整合到Qt项目中进行编译,无需依赖qmake过程。

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

1..ui生成.h,.cpp文件:

(1)、用命令

uic -o hello.h hello.ui<wbr><wbr><wbr><wbr>//注意这个是生成头文件的</wbr></wbr></wbr></wbr>

uic -i hello.h -o hello.cpp hello.ui<wbr>///这时生成与hello.h相对应的hello.cpp文件</wbr>

(2)、

uic -o hello.h hello.ui

uic -o hello.cpp impl hello.h hello.ui<wbr><wbr><wbr>//<wbr>这也是 生成 与hello.h相对应的hello.cpp文件</wbr></wbr></wbr></wbr>

<wbr><p style="margin-top:0px; margin-bottom:10px; padding-top:0px; padding-bottom:0px"> 2.moc.exe xxx.h -o moc_xxx.cpp。</p> <p style="margin-top:0px; margin-bottom:10px; padding-top:0px; padding-bottom:0px"> 3.rcc.exe -name xxxxxx.qrc-oqrc_xxx.cpp</p> <p style="margin-top:0px; margin-bottom:10px; padding-top:0px; padding-bottom:0px"> 4.把moc_xxx.cpp添加到工程里面。</p> <p style="margin-top:0px; margin-bottom:10px; padding-top:0px; padding-bottom:0px"> 5.直接运行编译。</p> <p style="margin-top:0px; margin-bottom:10px; padding-top:0px; padding-bottom:0px"> 这样的好处:无需qmake -project,qmake。</p> </wbr>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值