Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M_PI undefined when Compiling on Windows 10 under Visual Studio 2022 #741

Closed
matty0ung opened this issue Apr 14, 2023 · 3 comments
Closed

Comments

@matty0ung
Copy link
Contributor

          Compiling on Windows 10 under Visual Studio 2022 still getting error. Please see below.

C++ Language Standard used: ISO C++17 Standard (/std:c++17).
3>RadarChart.cpp
3>D:\Git\brewtarget\src\RadarChart.cpp(50,40): error C2065: 'M_PI': undeclared identifier
3>D:\Git\brewtarget\src\RadarChart.cpp(50,17): error C2737: '`anonymous-namespace'::RadiansInACircle': const object must be initialized

Originally posted by @Lubart in #539 (comment)

@Lubart
Copy link

Lubart commented Apr 25, 2023

Should be also an easy fix. If C++20 is used. Tested on VS 2022 and Kali, GCC v. 12.2.0.
#include numbers // std::numbers
#include iomanip
#include iostream
int main() {
std::cout << std::fixed << std::setprecision(20);
std::cout << "float " << std::numbers::pi_v << std::endl;
std::cout << "double " << std::numbers::pi << std::endl;
std::cout << "long double " << std::numbers::pi_v << std::endl;
std::cout << "exact " << "3.141592653589793238462643383279502884197169399375105820974944" << std::endl;
}

@matty0ung
Copy link
Contributor Author

I've made the fix on my local machine, so will include it in the next PR.

@matty0ung
Copy link
Contributor Author

I hope this is fixed in https://github.com/Brewtarget/brewtarget/releases/tag/v3.0.8, but I don't have Visual Studio installed, so have not checked directly. Please reopen this issue if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants