QT中运行程序时出现错误“ QApplication: No such file or directory"
来源:互联网 发布:linux下vim环境配置 编辑:程序博客网 时间:2024/05/22 07:48
在根目录下创建 一个文件夹,名称为hello,在该文件夹下创建一个hello.cpp文件,内容如下:
#include <QApplication>#include <QLabel>int main(int argc, char **argv){ QApplication a(argc, argv); QLabel mylabel("Hello the World"); mylabel.show(); return a.exec();}
在该文件下运行以下命令:
qmake -project
该命令生成一个hello.pro工程文件
qmake
该命令生成一个Makefile文件
make
该命令用来生成目标文件:hello,hello.o文件
不过在此过程中遇到一个错误:
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o hello.o hello.cpp
hello.cpp:1:24: fatal error: QApplication: No such file or directory
#include <QApplication>
^
compilation terminated.
make: *** [hello.o] Error 1
原因:没有安装QT4的开发包
解决方案:
把开发包装上,在Ubuntu下使用如下命令:sudo apt-get install libqt4-dev
此时再运行make命令即可生成hello,hello.o文件,
在该目录下运行./hello命令,即可运行生成的程序。
0 0
- QT中运行程序时出现错误“ QApplication: No such file or directory"
- 解决QT中错误error: QApplication: No such file or directory #include <QApplication>
- QT5出现QApplication: No such file or directory错误
- Qt5编译时出现<QtGui/QApplication> ---> No such file or directory错误解决办法
- Ubuntu下QT程序中编译时出现speex/speex.h: No such file or directory
- Qt 5.1 QApplication: No such file or directory
- QT编译出现fatal error: QApplication: No such file or directory
- qmake 常见错误:QApplication: No such file or directory
- QT编译错误 No such file or directory #include<QApplication>解决方法
- Qt5中qapplication no such file or directory
- error: QApplication: No such file or directory
- QApplication: No such file or directory解决办法
- QApplication: No such file or directory解决方案
- “QApplication”: No such file or directory
- qt no such file or directory 错误
- Qt5.2.0创建空Qt项目时提示 "QApplication": No such file or directory 解决方案
- QT中编译时出现main.cpp: No such file or directory
- 也谈Qt经典出错信息之QApplication: No such file or directory
- 手动将Apache注册为系统服务
- cocos2dx3.2 加载地图和读取数据的简单使用
- HDFS常用操作
- 【Android/java】3种时间获取方法的差异
- Android数据库操作
- QT中运行程序时出现错误“ QApplication: No such file or directory"
- 第十七周 项目7 电子词典结构体版
- 65Popupwindow的美化&&屏幕适配&&像素转dp的工具类的写法
- java 日期计算(几天前后)
- 嵌入式软件的重构思想
- Zernike矩及Opencv实现
- 树莓派驱动步进式电机python编程实现
- Android自定义类似ProgressDialog效果的Dialog
- 【cocos2d-js官方文档】二十五、Cocos2d-JS v3.0中的单例对象