问题
有网友抱怨:在windows下运行 configure,出错:
"QtCore/qconfig.h": No such file or directory
答案
在Windows下编译Qt,首先去看Qt Manual 中的下面两篇文章不为过吧?
- Qt for Windows Requirements
- Installing Qt on Windows
后者无需介绍,网络上类似的东西一把一把的。而前者却被往往被大家忽略了(呵呵,是不是有些不可原谅?)
If you are using a source edition of Qt, you must first install Perl so that the syncqt script invoked by configure can be executed.
这就是最直接的答案了:从源码编译Qt,你必须首先安装perl 。
疑问?
很多人肯定有疑问:为什么网络上那么多的资料中都没提这一点,而且还成功了?
因为大家获取Qt源码的方式不一样!
- 不少人会去下载QtSDK,然后发现里面用的是mingw,他觉得不爽,直接在这个基础上configure
- 有的是直接去源码仓库中抓取Qt的源码
有什么区别?
- Qt 源码的根目录下中没有"include"这个子目录
- 你通过其他方式获取的代码中已经包含了"include"子目录
configure
如果你打开include子目录下面的头文件查看,你会发现真实的代码全部都在src子目录下。
- include 子目录是在configure的过程中生成的,而这个需要perl的参与
当你使用的不是纯正的源码时,include子目录很可能已经包含在里面的,这时就不需要perl参与了。
注:以下文件也是configure时生成的:
- src/corelib/global/qconfig.cpp
- src/corelib/global/qconfig.h
- ...
参考