我的代码的最小部分如下:
#include <charconv>
#include <string_view>
#include <cmath>
int main() {
return 0;
}
double strparse(std::string_view s, int field, int a, int b) {
double candidates[3];
auto format = std::chars_format::fixed;
return 0;
}
但是,在以下命令下进行编译:
g++ -std=c++17 bob.cpp
使用g ++ 9.2.1
返回:
bob.cpp: In function ‘double strparse(std::string_view, int, int, int)’:
bob.cpp:12:24: error: ‘std::chars_format’ has not been declared
12 | auto format = std::chars_format::fixed;
| ^~~~~~~~~~~~
我不确定为什么不编译-有人可以帮忙吗?