mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
4.07k stars 361 forks source link

Dependancy on `stdalign.h` breaks compilation with MS VC #567

Closed orcmid closed 2 years ago

orcmid commented 2 years ago

miniaudio.h 0.11.9 will not compile using Microsoft VC/C++ because there is no stdalign.h supported in any current version of Microsoft Visual Studio.

See https://learn.microsoft.com/en-us/cpp/standard-library/cstdalign?view=msvc-170

The defect is at line 3893.

It should be

#if !defined(_MSC_VER) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)

Then the _MSC_VER case down in the #else will work.

mackron commented 2 years ago

Thanks for the report. I guess this only affects newer versions of MSVC because I use 2017 as my main development environment and never encountered this (it doesn't get past the __STDC_VERSION__ >= 201112L part).

Fixed in the dev branch.

orcmid commented 2 years ago

@mackron: Thanks for the report. I guess this only affects newer versions of MSVC because I use 2017 as my main development environment and never encountered this (it doesn't get past the __STDC_VERSION__ >= 201112L part).

Yes, I confirmed it with VS2022 and the beginner who stumbled on it was using VS2019.