| Summary: | Build warning on MSVC: M_PI redefined | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Albert Vaca Cintora <albertvaka> |
| Component: | build | Assignee: | Sam Lantinga <slouken> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | Keywords: | target-2.0.16 |
| Version: | 2.0.12 | ||
| Hardware: | All | ||
| OS: | Windows 10 | ||
|
Description
Albert Vaca Cintora
2020-08-09 18:26:27 UTC
I found this problem is quite more easy to reproduce than I thought. If _USE_MATH_DEFINES is set, just by including SDL.h we trigger the compiler warning in MSVC about M_PI being redefined. This is due to the following include chain: SDL.h -> SDL_main.h -> SDL_stdinc.h -> #define M_PI SDL.h -> SDL_thread.h -> process.h -> corecrt_startup.h -> math.h -> #define M_PI again (if _USE_MATH_DEFINES is set) I think SDL should not define M_PI itself and instead include math.h It seems this fork of SDL has a similar fix to what I'm proposing here, so at least one more person found this annoying: https://github.com/Jimbly/SDL/commit/2e42806dbca55a22b5b15a4a5becc779f2118735 |