/opt/petalinux/2021.1/sysroots/cortexa72-cortexa53-xilinx-linux/usr/include/xir/util/any.hpp:28:2: error: #error "must enable c++17" 28 | #error "must enable c++17" | ^~~~~
定位到目标文件
#pragma once #if __has_include() && __cplusplus > 201700 #include #if !__cpp_lib_any > 0 #error "must enable -std=c++17 to use std::any" #endif namespace xir { using any = std::any; namespace stdx = ::std; } // namespace xir #else #error "must enable c++17" #endif
解决方法:
原因是写的CMakeLists.txt文件没有添加对C++17的支持,所以在工程目录下的CMakeLists.txt中添加以下语句:
SET( CMAKE_CXX_FLAGS "-std=c++17 -O3")
其中,参数CMAKE_CXX_FLAGS含义是: set compiler for c++ language
而后面的-O3(是字母opq的o,大写的欧)是用来调节编译时的优化程度的,最高为-O3,最低为-O0(即不做优化)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)