smallB
smallB

Reputation: 17120

std::tr1 has not been declared

I'm trying nth time to compile qt from source, this time with option configure -release -platform-win32 but I'm getting errors:
enter image description here

Anyone knows how to fix it?
Thanks.

Upvotes: 7

Views: 14073

Answers (5)

Blob
Blob

Reputation: 146

I was able to resolve this very issue just by putting

QMAKE_CXXFLAGS += -std=gnu++98

in src/script/script.pro. I hope it doesn't cause any problems to have compiled some of the compilation units c++-11 and other gnu++98.

Upvotes: 0

jacob
jacob

Reputation: 1630

You can replace the preliminary std::tr1::has_trivial_constructor by the C++11 standardized std::is_trivially_constructible. See http://www.cplusplus.com/reference/type_traits/is_trivially_constructible .

Upvotes: 2

Ally
Ally

Reputation: 3109

Try (wrapped in the macro around #include <type_traits>) adding #include <tr1/memory> in TypeTraits.h

Upvotes: 0

Michael Burr
Michael Burr

Reputation: 340208

You can run into this problem when compiling Qt with a MinGW compiler (maybe any gcc compiler) that defaults to compiling C++ programs with the C++11 standard enabled.

The 3rd party library JavaScriptCore tries to define some wrappers that 'normalize' has_trivial_constructor and related templates, but apparently it hasn't been been updated yet to deal with GCC's updates to incorporate the completed C++11 standard.

The fix is to use a MinGW compiler that doesn't enable C++11 features by default, or to turn them off by editing mkspecs\win32-g++\qmake.conf to add the -std=gnu++98 option to C++ builds:

QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=gnu++98
#                               ^^^^^^^^^^^^

Upvotes: 8

AJG85
AJG85

Reputation: 16197

If you are using gcc 4.7 you have access to most of C++11 if you compile with -std=c++11 or -std=gnu++11 you can check out the supported features under std namespace here. tr1 sub namespace was for the draft which has been made standard now.

Upvotes: 2

Related Questions