当前位置:编程学习 > wap >>

Qt程序控制台版本或release版编译时找不到系统头文件

简单程序为:

#include <QtCore>
#include<QApplication>
int main(int argc,char **argv)
{
QApplication app(argc,argv);
QString str1 = "test";
QByteArray ba = str1.toLatin1();
const char * c_str2 = ba.data();
printf("str2:%s",c_str2);
return app.exec();
}


可是在使用控制台编译的时候报找不到系统头文件QtCore的错误,同时发现在release版本的情况下也会报错找不到系统头文件。但是在debug版本的情况下就可以正常编译,产生最终程序。
   
    另外,目前已经在2台电脑上遇到这个情况了。2台电脑的配置情况分别是:win7+qt4.6.3  与xp+qt4.3.2



   这是怎么回事?深感困惑。 --------------------编程问答-------------------- qmake 了吗?

如果Qt 的位置发生了变化 需要 重新 configure. --------------------编程问答--------------------
引用 1 楼 dext 的回复:
qmake 了吗?

如果Qt 的位置发生了变化 需要 重新 configure.


已经运行了qmake -project
qmake
在nmake的时候出现的这个错误。


qt的位置没有发生变化,debug版本调试依然正确。 --------------------编程问答-------------------- #include <QString>
#include <QByteArray>
#include<QApplication>
#include <stdio>
int main(int argc,char **argv)
{
QApplication app(argc,argv);
QString str1 = "test";
QByteArray ba = str1.toLatin1();
const char * c_str2 = ba.data();
printf("str2:%s",c_str2);
return app.exec();
}
应该够了把?
QtCore其实是一大堆头文件的集合,不建议 --------------------编程问答-------------------- 直接检查生成的makefile 文件,应该更容易解决问题 --------------------编程问答-------------------- 环境变量的关系吗? --------------------编程问答-------------------- 参考bin目录下的qtenv.bat设置Windows的环境变量 --------------------编程问答-------------------- 你的pro工程里 要加gui
QT       += core gui
这样QT才去找QtCore的头文件
补充:移动开发 ,  Qt
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,