使用VS+QT时遇到了这个报错,解决方法如下:
将这段代码:
#if defined(__cplusplus)
#if __has_cpp_attribute(clang::fallthrough)
# define Q_FALLTHROUGH() [[clang::fallthrough]]
#elif __has_cpp_attribute(gnu::fallthrough)
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
#elif __has_cpp_attribute(fallthrough)
# define Q_FALLTHROUGH() [[fallthrough]]
#endif
#endif
改为如下代码:
#if defined(__cplusplus)
#if defined(__clang__)
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
# define Q_FALLTHROUGH() [[clang::fallthrough]]
#endif
#elif defined(__GNUC__)
#if QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
#endif
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
# define Q_FALLTHROUGH() [[fallthrough]]
#endif
#endif
即可。
最后
以上就是专一黑猫最近收集整理的关于#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough) 错误的全部内容,更多相关#if内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复