How do I get the C++ 17 Headers

Oct 26, 2016 at 11:02am
Hi,

I really like the new additions of C++17, but in MinGW -std=c++1z doesn't give me an error, but whenever I try to include a new header it says, the file couldn't be found. So where can I get them and where should I place them?

My MinGW/G++ version is

g++.exe (i686-posix-dwarf, Built by MinGW-W64 project) 6.1.0

Thanks,
Kim
Oct 26, 2016 at 11:24am
Those that are available are experimental, but if you want to use them. The ones that you can use already came with your compiler. You just need to add the right command line argument to your compiler to use them.

Look at: https://gcc.gnu.org/projects/cxx-status.html#cxx1z
Oct 26, 2016 at 11:35am
So what should I do, when I want to use std::optional? Shouldn't -std=c++1z be enough?
Oct 26, 2016 at 11:50am
With 5.3 I get the same: fatal error: optional: No such file or directory
Oct 26, 2016 at 11:51am
#include <optional> does not exist.
P.S : Why are you eager for C++17 features already?
Last edited on Oct 26, 2016 at 11:52am
Oct 26, 2016 at 12:19pm
A find for name "optional" in folder "/usr/include" of a GCC 5.2.1 installation finds a file named "optional" in a subfolder "experimental".

Therefore, I could probably write #include <experimental/optional>
Oct 26, 2016 at 12:21pm
keskiverto Thank you so much. Could have probably found that out myself...
Oct 26, 2016 at 12:27pm
Nooo! error: 'optional' is not a member of 'std'
std::optional<unsigned int> value; from std::optional<unsigned int> value;
Oct 26, 2016 at 12:31pm
Ah! std::experimental::optional<unsigned int> value;
Topic archived. No new replies allowed.