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

C2065 'M_PI': undeclared identifier error when building glview.cpp on WIN32 #474

Closed
jam3sward opened this issue Mar 18, 2024 · 4 comments
Closed

Comments

@jam3sward
Copy link
Contributor

jam3sward commented Mar 18, 2024

Describe the issue

M_PI is not defined by <cmath> on WIN32 unless you first define _USE_MATH_DEFINES
This causes glview.cc to fail to build, but it is easily fixed by defining _USE_MATH_DEFINES prior to including <cmath>. This could either be done in the glview.sln or by #define in glview.cc.

To Reproduce

  • Windows 11
  • Visual Studio Professional 2022 version 17.9.1
@syoyo
Copy link
Owner

syoyo commented Mar 18, 2024

M_PI macro is a problematic thing.

constexpr double kPI = 3.14159265358979323846 is recommended to use.
PR is much appreciated!

@jam3sward
Copy link
Contributor Author

PR created at #475

@jam3sward
Copy link
Contributor Author

This issue was fixed at b132612.

tinygltf is awesome by the way - great job!

@syoyo
Copy link
Owner

syoyo commented Mar 22, 2024

Thanks!

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

No branches or pull requests

2 participants