Can’t use #include <cmath> nor <numbers> in C++20 [closed]

  c++, c++20

I am quite new to programming and I have been running into an issue, that is preventing me from doing exercises, exprimenting, and learning from the book that I am currently reading.

Currently I am reading – "Beginning C++20 From Novice to Professional" by Ivor Horton and Peter Van Weert.

I am currently only using one IDE (Visual Studio 2019), and my issue is that when I include cmath or numbers it won’t let me use their Namespaces. When I try to type in std::numbers::pi (from numbers), it tells me that: "name followed by ‘::’ must be a class or namespace name". Which I believe it already is. Also when I try to use M_PI (from cmath), it tells me that: "identifier ‘M_PI’ is undefined". However this is not a problem with other Standard Libraries I use such as iomapip and iostream.

I have been looking all over the internet for a solution, and I thought maybe someone could help me here. As said I am quite new and don’t know a great deal about C++, or any other languages other than what I’ve read in the book.

Any answers and suggestions are welcome. Maybe I can learn a thing or two from them.

Source: Windows Questions C++

LEAVE A COMMENT