我的代码的最小部分如下:
然而,在以下命令下编译它:
使用g++ 9.2.1时,返回:
我不确定为什么这个代码无法编译 - 有人可以帮忙吗? 演示链接
#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;
| ^~~~~~~~~~~~
我不确定为什么这个代码无法编译 - 有人可以帮忙吗? 演示链接