clone45 / voxglitch

Modules for VCV Rack
GNU General Public License v3.0
101 stars 16 forks source link

Compiler error with GCC-11 #91

Closed dbgrande closed 2 years ago

dbgrande commented 3 years ago

When I try compiling your voxglitch plugin with GCC-11 (linux) I get the following errors:

src/Common/AudioFile.h:586:73: error: ‘numeric_limits’ is not a member of ‘std’
  586 | sample = (T) sampleAsInt / static_cast<float> (std::numeric_limits<std::int32_t>::max());
...

I was able to fix it with the following:

diff --git a/src/Common/AudioFile.h b/src/Common/AudioFile.h
index 1eda1f0..766f8e3 100644
--- a/src/Common/AudioFile.h
+++ b/src/Common/AudioFile.h
@@ -31,6 +31,7 @@
 #include <unordered_map>
 #include <iterator>
 #include <algorithm>
+#include <limits>

 // disable some warnings on Windows
 #if defined (_MSC_VER)

Based on the following from: https://www.gnu.org/software/gcc/gcc-11/porting_to.html

Header dependency changes Some C++ Standard Library headers have been changed to no longer include other headers that they do need to depend on. As such, C++ programs that used standard library components without including the right headers will no longer compile.

The following headers are used less widely in libstdc++ and may need to be included explicitly when compiled with GCC 11: • \<limits> (for std::numeric_limits) • \<memory> (for std::unique_ptr, std::shared_ptr etc.) • \<utility> (for std::pair, std::tuple_size, std::index_sequence etc.) • \<thread> (for members of namespace std::this_thread.)

clone45 commented 3 years ago

This has been fixed and should be released soon! Thanks for not only submitting this bug, but showing me how to fix it!