Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 344
smallB Avatar asked Apr 27 '12 16:04

smallB


2 Answers

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
#                               ^^^^^^^^^^^^
like image 137
Michael Burr Avatar answered Nov 20 '22 09:11

Michael Burr


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.

like image 3
AJG85 Avatar answered Nov 20 '22 10:11

AJG85