Ubuntu下安装Qt4并创建简单窗口
2015-10-23 11:28
441 查看
环境:Ubuntu12
安装Qt4:sudo apt-get install qt4-dev-tools
完成后,创建工作目录,在目录下vi hello.cpp,写入
#include<qapplication.h>
#include<qpushbutton.h>
int main(int argc,char **argv)
{
QApplication app(argc,argv);
QPushButton hello("Hello world!",0);
hello.resize(100,30);
hello.show();
return app.exec();
}
在工作目录下依次执行以下命令:
qmake -project 此时目录下生成hello.pro文件
qmake hello.pro 此时目录下生成Makefile文件
make 此时目录下生成可执行文件hello
./hello 执行后显示出自己创建的窗口,里面有hello按钮
安装Qt4:sudo apt-get install qt4-dev-tools
完成后,创建工作目录,在目录下vi hello.cpp,写入
#include<qapplication.h>
#include<qpushbutton.h>
int main(int argc,char **argv)
{
QApplication app(argc,argv);
QPushButton hello("Hello world!",0);
hello.resize(100,30);
hello.show();
return app.exec();
}
在工作目录下依次执行以下命令:
qmake -project 此时目录下生成hello.pro文件
qmake hello.pro 此时目录下生成Makefile文件
make 此时目录下生成可执行文件hello
./hello 执行后显示出自己创建的窗口,里面有hello按钮
相关文章推荐
- Ubuntu 默认壁纸历代记
- Ubuntu Remix Cinnamon 20.04 评测:Ubuntu 与 Cinnamon 的完美融合
- 关于Ubuntu 11.10启动提示waiting for the network configuration的问题
- 在 Ubuntu 桌面中使用文件和文件夹
- ubuntu下chrome无法同步问题解决
- Ubuntu Linux使用体验
- 使用 GNOME 优化工具自定义 Linux 桌面的 10 种方法
- 以Ubuntu 9.04为例 将工作环境迁移到 Linux
- VirtualBox虚拟机XP与宿主机Ubuntu互访共享文件夹
- 从USB安装Ubuntu Server 10.04.3 图文详解
- Ubuntu 15.04 正式版发布下载
- Linux-Ubuntu 10.04安装Cadence-ic610 方法总结图解
- Ubuntu 12.04和Windows 7双系统安装图解
- 开机出现:grub rescue的修复方法
- Ubuntu连接Android真机调试
- 你应该选择 Ubuntu 还是 Fedora?
- 100 个最佳 Ubuntu 应用(中)
- 看看我的Ubuntu Linux截图
- Ubuntu 12.04 LTS服务器版安装过程及使用图解
- Windows 7/8/8.1 硬盘安装 Ubuntu 14.04 实现双系统