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

Cannot build tests on MSVC #75

Closed
SegaraRai opened this issue Nov 23, 2020 · 3 comments
Closed

Cannot build tests on MSVC #75

SegaraRai opened this issue Nov 23, 2020 · 3 comments

Comments

@SegaraRai
Copy link

MSVC displayed following error when I tried to build vorbis with CMake.

vorbis\test\util.c(37,41): error C2065: "M_PI": undeclared identifier

MSVC seems to require #define _USE_MATH_DEFINES before #include <math.h> to use M_PI.
Build succeeded once I add it to L16.

@rillian
Copy link
Contributor

rillian commented Nov 23, 2020

I see. M_PI is also referenced by several files in lib but the library source generally includes os.h which has a fallback definition of M_PI for MSVC. The tone utility should have the same problem, but it looks like the CMake build doesn't try to compile it.

gcc enables M_PI by default as a gnu extension (part of X/Open) In my editor, clang-complete also complains about the missing definition.

So defining _USE_MATH_DEFINES here, possibly protected by an #ifdef MSVC is probably the correct fix, but it might be better to change the line in os.h similarly. tone.c can just include os.h since it's internal to the library source.

@rillian
Copy link
Contributor

rillian commented Nov 23, 2020

And obviously we should add the building and running the tests to the appveyor config!

@rillian
Copy link
Contributor

rillian commented May 10, 2021

This` should be addressed by 894d1b1. Thanks for reporting!

@rillian rillian closed this as completed May 10, 2021
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