Switching from Qt 5.6 to Qt 5.7 - "no member 'make_unique' in the std namespace"

I have a CMake Qt project that uses several C ++ 14 functions, including std::make_unique . This is usually handled either by:

 LIST(APPEND CMAKE_CXX_FLAGS -std=c++14) 

or

 ADD_COMPILE_OPTIONS(-std=c++14) 

I would like to upgrade the project from version 5.6 to 5.7, but during the build of the test there were several failures with an error

no member 'make_unique' in the std namespace

I checked all the relevant headers and compilation options in place and eliminated any environmental issues. This is definitely a problem using Qt 5.7. Is there a workaround?

+5
source share
1 answer

It so happened that this is a known issue with CMake / Qt 5.7 . Apparently, since CMake 3.1, the correct way is to determine which C ++ standard to use in CMake, with

 SET(CMAKE_CXX_STANDARD 14) 

As in Qt 5.7, using any method other than CMAKE_CXX_STANDARD will result in C ++ 14 errors, such as the one mentioned in the question. With this method, all errors for my assembly were removed.

Anecdote, the error report is quite interesting, since initially this problem was considered an issue blocker, then it was reduced to a known problem and, in the end (apparently) it was even cleared of the list of releases .

+9
source

All Articles