Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7010

C/C++ • Where is std::format ?

$
0
0
I have a Raspberry Pi Zero 2 W. I want to convert a float to it's string representation and be able to control precision. I see [url][https://en.cppreference.com/w/cpp/utili ... format/url]. But if I try a simple sample it complains that the format include file doesn't exist.

```
/*
* This is a test
*/
#include <format>
#include <string>

int main() {

string sdata = std::format("Hello {}!\n", "world");
}
```

Results in:

```
$ g++ fmt_test.cpp
fmt_test.cpp:4:10: fatal error: format: No such file or directory
4 | #include <format>
| ^~~~~~~~
compilation terminated.

```

Is there a package that will provide std::format ?

Statistics: Posted by chriskot870 — Sat Nov 23, 2024 5:22 pm — Replies 2 — Views 44



Viewing all articles
Browse latest Browse all 7010

Trending Articles