QT:make: Nothing to be done for `first'和error:QtSql:No such file or directory

来源:互联网 发布:网络游戏洗钱 知乎 编辑:程序博客网 时间:2024/06/06 02:03

这是QT编程中常见的两个编译错误.可能你的代码在window下编译能正常通过,可是到到linux下编译就出现这个问题.解决方案如下:

在你编译QT代码之前最好先make clean一下, 因为*.o之类的文件可能影响到编译.


在qt目录下make后出现以下错误:

make: Nothing to be done for `first'

解决:将你当前目录下的,删除你程序主要的 *.cpp 和 *.h文件以外的所有文件。

接着执行:

#qmake  -project

#qmake

#make

运行正常。



QtNetwork: No such file or directory 问题的解决

最近学习Qt,在Qt4.3.2版本编译包含如下头文件时
#include <QtNetWork>
程序在nmake时出现
server.h:7:21: error: QtNetwork: No such file or directory

终于找到了解决办法
在当前目录下找到 .pro文件
在其中手工添加一行:
QT += network

具体操作步骤如下
1: qmake -project
2: 手工添加 Qt += network
3: qmake
4: nmake

OK,一切正常(假如代码中没有错误)

原创粉丝点击