Build Error "‘uint32_t’ does not name a type" with gcc 13 on Linux
lzieniew opened this issue · comments
I've also created Pull Request with my propesed fix for this issue: #141
Issue Description:
Attempting to build the Maximilian library (or its examples) using standard cmake and make commands results in compilation errors. The errors seem to be related to integer comparison sign mismatches and an undefined type 'uint32_t'.
Steps to Reproduce:
- clone the maximilian repository
- navigate to any example, eg
cd Maximilian/cpp/commandline/maximilian_examples/1.TestTone/
mkdir build
cd build
cmake ..
make
Observe the compilation errors (truncated):
[ 20%] Building CXX object CMakeFiles/maximilian.dir/main.cpp.o
In file included from /home/lzieniew/Documents/Maximilian/cpp/commandline/maximilian_examples/1.TestTone/main.cpp:1:
/home/lzieniew/Documents/Maximilian/cpp/commandline/maximilian_examples/1.TestTone/../../../../src/maximilian.h: In member function ‘double maxiRingBuf::reduce(size_t, reduceFunction, double)’:
/home/lzieniew/Documents/Maximilian/cpp/commandline/maximilian_examples/1.TestTone/../../../../src/maximilian.h:472:32: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
472 | for(int i=idx-N; i < idx; i++) {
| ~~^~~~~
/home/lzieniew/Documents/Maximilian/cpp/commandline/maximilian_examples/1.TestTone/../../../../src/maximilian.h:477:54: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<double>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
477 | for(int i=F64_ARRAY_SIZE(buf)-(N-idx); i < buf.size(); i++) {
| ~~^~~~~~~~~~~~
/home/lzieniew/Documents/Maximilian/cpp/commandline/maximilian_examples/1.TestTone/../../../../src/maximilian.h:481:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
481 | for(int i=0; i < idx; i++) {
| ~~^~~~~
/home/lzieniew/Documents/Maximilian/cpp/commandline/maximilian_examples/1.TestTone/../../../../src/maximilian.h: At global scope:
/home/lzieniew/Documents/Maximilian/cpp/commandline/maximilian_examples/1.TestTone/../../../../src/maximilian.h:1812:13: error: ‘uint32_t’ does not name a type
1812 | typedef uint32_t bitsig;
| ^~~~~~~~
/home/lzieniew/Documents/Maximilian/cpp/commandline/maximilian_examples/1.TestTone/../../../../src/maximilian.h:52:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
51 | #include <numeric>
+++ |+#include <cstdint>
52 |
/home/lzieniew/Documents/Maximilian/cpp/commandline/maximilian_examples/1.TestTone/../../../../src/maximilian.h:1818:12: error: ‘bitsig’ does not name a type
1818 | static bitsig sig(bitsig v) { return v; }
| ^~~~~~
Expected Behavior:
The project should compile successfully without errors.
Actual Behavior:
Compilation fails with multiple errors.
System Information:
Operating System: Linux, kernel 6.7.0-arch3-1
Compiler Version: g++ (GCC) 13.2.1 20230801
CMake Version: 3.28.1
I've also checked minimal build of Maximilian on docker, with images gcc12 and gcc13, and on gcc 13 I had the same error, while the gcc12 it compiled ok (in both I had to also install cmake and libasound2-dev) - so I guess the issue is caused be some changes in gcc 13