qt4 for Windows 安装

前几天下了个qt-win-opensource-4.7.0-beta1-mingw.exe,本来以为装了就可以用的,用了才发现没有装mingw,于是去百度一下----->下载Dev Cpp devcpp-4.9.9.2_setup.exe(含有mingw)--->安装Dev Cpp--->用命令编译qmake,make---->结果出现好几个错误和一个警告:

Code:
  1. Code:      
  2. undefined reference to `_Unwind_Resume'         
  3. undefined reference to `__gxx_personality_v0'         
  4. warning: no newline at end of file         

PS:注意这个警告

main.cpp:10:4: warning: no newline at end of file

错误原由: Each instance of a backslash character (/) immediately followed by a
new-line character is deleted, splicing physical source lines to form logical
source lines. Only the last backslash on any physical source line shall be
eligible for being part of such a splice. A source file that is not empty
shall end in a new-line character, which shall not be immediately preceded
by a backslash character before any such splicing takes place.

改正方法:在main函数结束后打个回车符号

我猜可能是PATH的问题,修改了,还是有错误,于是继续百度,我觉得是安装的时候出了问题,重新安装一下,成功了,呵呵呵

给大家分享下安装过程和Hello World

第一步:先去官网下载qt-sdk-win-opensource-2010.02.1.exe和qt-win-opensource-4.6.2-mingw.exe,地址http://qt.nokia.com/downloads-cn

先安装QT SDK,我安装在D:/QT/2010.02.1,再安装QT库,我安装在D:/QT/4.6.2

在安装QT库的时候要你指定mingw的安装位置,我的是D:/QT/2010.02.1/mingw

第二步:右击我的电脑->高级->环境变量,编辑系统环境变量 Path ,按照我的安装路径,我加入 D:/QT/4.6.2/bin;D:/QT/2010.02.1/bin然后确定;

第三步:编辑和编译

//hello.cpp

Code:
  1. #include <QApplication>   
  2. #include <QLabel>   
  3.   
  4. int main(int argc, char *argv[])   
  5. {   
  6.     QApplication app(argc,argv);   
  7.     QLabel *label= new QLabel("Hello World !");   
  8.     label->show();   
  9.     return app.exec();   
  10.  
  1. }   
  1.  

保存到 D:/QT/4.6.2/hello/hello.cpp,命令行模式下进入该文件夹,输入三个命令如下

qmake -project

qmake hello.pro

make

第四步:运行

 release 文件夹,会看到一个可执行文件 hello.exe ,运行他,你就可以看到 Hello world 了,如图

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值