原因:

CMakeLists.txt中设置

set(CMAKE_CXX_STANDARD 11)

此时,在编译使用 std::make _ unique 创建 std:: unique_ptr智能指针对象,报错“error::make_unique is not a member of ‘std’,是因为 std::make _ unique在C++14以后新加入的函数;

解决办法:

方法1.

修改设置:set(CMAKE_CXX_STANDARD 14) 

方法2.

将std::make_unique<T>(...) 替换为 std::unique_ptr<T>(new T(...))

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐