Qt编译 error: ‘std::tr1’ has not been declared
2018-01-24 10:17
495 查看
前言
在deepin 64 系统编译Qt(执行make)时报错:In file included from ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastAllocBase.h:84:0, from ../3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h:24, from ../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp:50: ../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:173:69: error: ‘std::tr1’ has not been declared template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { }; ^~~ ../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:173:74: error: expected ‘{’ before ‘has_trivial_constructor’ template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { }; ^~~~~~~~~~~~~~~~~~~~~~~ ../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:68: error: ‘std::tr1’ has not been declared template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { }; ^~~ ../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:73: error: expected ‘{’ before ‘has_trivial_destructor’ template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
查询得知是编译器参数设置不对,应该加上:
-std=gnu++98参数
参考链接:
https://stackoverflow.com/questions/10354371/stdtr1-has-not-been-declared
解决办法:
1、 找出当前编译的版本,其目的是定位源码中 mkspecs/… 下面的编译选项设置目录执行./configure 后,在输出文本中搜索
mkspecs或者
Build type:,可以找到对应的文件夹
或者:
2、打开
mkspecs/对应版本/qmake.conf
修改其中的
QMAKE_CXXFLAGS为:
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=gnu++98
如果该文件中不存在
QMAKE_CXXFLAGS参数,则在该文件包含的头文件中查找。
例如:
该文件不存在
QMAKE_CXXFLAGS参数,则打开
../common/linux.conf、
../common/gcc-base-unix.conf、
../common/g++-unix.conf这三个文件。如果没有找到还需要递归的打开着三个文件中包含的文件。
在
../common/gcc-base.conf(包含在文件
../common/gcc-base-unix.conf中)文件中找到,并修改为如下所示。
在
../common/g++-base.conf(包含在文件
../common/g++-unix.conf中)文件中找到,并修改为如下所示。
然后执行:
To reconfigure, run ‘make confclean’ and ‘configure’.
make confclean ./configure (...) make -j4
make install
编译安装完成。
相关文章推荐
- 编译opencv2.4.11时出现错误:error: ‘NppiGraphcutState’ has not been declared
- 【COCOS2DX-ANDROID-游戏开发之十九】android编译之ctime:66: error: ‘::clock_t’ has not been declared
- error: ‘std::memset’ has not been declared问题的解放办法
- QT,error: '::ioctl' has not been declared,调用ioctl
- 配置编译linux下QT程序编译时的错误:QMAKESPEC has not been set, so configuration cannot be deduced.
- cmath:1157:11: error: '::hypot' has not been declared
- Solve error: 'Qt::WFlags' has not been declared
- linux下编译QT出错:QMAKESPEC has not been set, so configuration cannot be deduced
- linux下QT程序编译时的错误:QMAKESPEC has not been set, so configuration cannot be deduced.
- QT程序编译时的错误:QMAKESPEC has not been set, so configuration cannot be deduced.
- 安装opencv出现:cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared
- QT 里面‘vector’ has not been declared解决
- Thrift编译错误('::malloc' has not been declared)
- rosetta mpi编译时出现 MPI has not been declared 错误
- error: ‘::WSAGetLastError’ has not been declared
- QT程序编译时的错误:QMAKESPEC has not been set, so configuration cannot be deduced.
- ubuntu装opencv error: ‘NppiGraphcutState‘ has not been declared
- 安装opencv出现:cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared
- cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared
- windows平台theano在安装gcc后出现error: '::hypot' has not been declared