我正在尝试使用CMake生成一个iOS Xcode项目。首先,我生成了该项目,并且没有出现任何错误。一旦生成完成,我尝试使用下面的命令进行构建:
cmake --build _builds --config Release --target install
这时我就会遇到错误。我想可能是因为我使用的库的C++版本与编译器不兼容引起的;但我不确定。这是运行构建命令时出现的错误:
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/utils.hh:77:14: error: expression is not an integral
constant expression
case Code::NONE:
^~~~~~~~~~
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:42:1: error: unknown type name
'constexpr'
constexpr auto ab_generators = std::array<unsigned,12>
^
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:42:25: error: illegal storage class on
file-scoped variable
constexpr auto ab_generators = std::array<unsigned,12>
^
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:43:3: error: expected '(' for
function-style cast or type construction
{
^
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:48:1: error: unknown type name
'constexpr'
constexpr unsigned int ab_rate = ab_generators.size();
^
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:49:1: error: unknown type name
'constexpr'
constexpr unsigned int order = 15;
^
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:62:1: error: unknown type name
'constexpr'
constexpr unsigned int state_count = (1 << order);
^
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:63:1: error: unknown type name
'constexpr'
constexpr unsigned int state_mask = (1 << order) - 1;
^
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:70:12: error: expression is not an
integral constant expression
case ConvBlockType::a:
^~~~~~~~~~~~~~~~
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:71:12: error: expression is not an
integral constant expression
case ConvBlockType::b: return (msg_size + order) * ab_rate / 2;
^~~~~~~~~~~~~~~~
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:72:12: error: expression is not an
integral constant expression
case ConvBlockType::ab: return (msg_size + order) * ab_rate;
^~~~~~~~~~~~~~~~~
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:143:27: error: a space is required
between consecutive right angle brackets (use '> >')
vector<vector<StateEntry>> error_count;
^~
> >
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:143:17: warning: template argument uses
local type 'StateEntry' [-Wlocal-type-template-args]
vector<vector<StateEntry>> error_count;
^~~~~~~~~~
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:145:55: error: expected '(' for
function-style cast or type construction
error_count.emplace_back (state_count, StateEntry {0, -1, 0});
~~~~~~~~~~ ^
/Users/edwardpizzurro/Desktop/watermark-lib/audiowmark/convcode.cc:145:17: error: no member named
'emplace_back' in 'std::__1::vector<std::__1::vector<StateEntry, std::__1::allocator<StateEntry> >,
std::__1::allocator<std::__1::vector<StateEntry, std::__1::allocator<StateEntry> > > >'; did you mean
'__emplace_back'?
error_count.emplace_back (state_count, StateEntry {0, -1, 0});
这是我运行后得到的结果:
g++ --version
结果:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin