您的位置:首页 > 产品设计 > UI/UE

终于……我的qt可以build了,内牛满面,记录qlocale.cpp:6528error心路历程

2010-11-06 23:08 295 查看
纠结了1个月的时间,终于在今天晚上,就在今天就在今天(用天津话说效果更佳),我的qt竟然可以build了,写下日志记录下,顺便惊讶一下,国内竟然没有一个大神给出正确解释(或是我没找到,或是你们不屑?),这叫老夫情何以堪……

  问题如下:9月末开始钻研qt,从Eclipse开始搭建平台,按照网络搜的安装指南一步一步有条不紊,很快进行将Eclipse和cdt建好了,mingw和gdb稍后完成了,小试了一下Eclipse已经可以编译c++代码了,debug也顺利使用,紧接着下一步开始架设qt了。到nokia官网上下载qt-Eclipse-integration和qt4.7.0的新版库,下一步下一步的安装方法我表示压力不大。安装完成并在Eclipse中设置好qt库的路径后,似乎大功告成了,试用了下helloworld可以编译,可是问题来了,Eclipse中竟然无法生成release版文件和使用debug,万般无奈中用了将近半个月的无debug版qt。

直到半个月前,我偶然从朋友处得知需要在mingw中编译qt的库才可以使用qt的debug功能,于是我正常的使用configuration和Makefile,很不幸的遇到了

qlocale.cpp:6528error

查阅了很多国内高人的文章,办法似乎都不能有效解决这个问题,一直到我看到在qt官网一个提交bug的分页中http://bugreports.qt.nokia.com/,有人与我遇到类似的问题,位于[#qtbug-7576],解决问题的原文如下:

Both mingw and gcc have a float.h. The mingw version supplements the gcc version, declaring _clear87 and _control87 among other things. The mingw version has an #include_next which is meant to include the gcc version. This works only when the mingw include dir is first in the header search path.

In the gcc 4.4 mingw package from Qt, the mingw include dir is first. That's why it works. However, it probably should not be first. (I don't know why it's that way or who did it.)

But, often in other gcc/mingw installations the mingw include directory is last. In this case the gcc version is found first which leaves _clear87 and _control87 undeclared.

The easy and perhaps correct workaround is probably to move the #include_next<float.h> from the mingw version into the gcc version.

看来问题出在float.h这个头文件上,mingw中float和gcc中的float似乎在联系上有点问题,在编译qt的库时,我们需要让mingw的float中的#include_next<float.h>移动到gcc的float中,这样就能解决这个编译问题而来。至于为什么是这样就不明白了。。。求指教。

解决这个问题后,qt的编译和makefile就正常了,心情无限好啊,为了防止下次再次编译引起麻烦,我已经把整个库刻盘了。现在开始享受在Eclipse中使用qt的快感吧。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: