相关疑难解决方法(0)

错误:命名空间“std”中没有名为“enable_if_t”的模板;您的意思是“enable_if”吗?

我正在 macOS 10.13.6 上使用 Qt 5.11.3 进行编译。Qt使用的clang版本是:

$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -v
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Run Code Online (Sandbox Code Playgroud)

但我收到此错误:

error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
using FloatingOnly = std::enable_if_t<std::is_floating_point<T>::value, O>;
                     ~~~~~^~~~~~~~~~~
                          enable_if
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:423:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
Run Code Online (Sandbox Code Playgroud)

尝试过

到目前为止,我已经做了这些,但没有效果:

// On source *.cpp file

#include <type_traits>
Run Code Online (Sandbox Code Playgroud)
# On project *.pro file

CONFIG += c++17
QMAKE_CXXFLAGS += -std=c++17 # for …
Run Code Online (Sandbox Code Playgroud)

c++ qt qmake clang c++11

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×1

c++11 ×1

clang ×1

qmake ×1

qt ×1