g4klx / MMDVMHost

The host program for the MMDVM
GNU General Public License v2.0
378 stars 274 forks source link

add missing header file cstdint for using uint64_t and uint8_t #781

Closed cainbit closed 1 year ago

cainbit commented 1 year ago

M17Utils.cpp uses uint64_t NullController.cpp uses uint8_t but they do not include the cstdint header file, resulting in a compilation error.

W0CHP commented 1 year ago

Interesting. I compile this on countless systems, including automated CI/CD systems, and have never run into this issue. What does your development environment and toolchain consist of, exactly? Having this information would be helpful.

cainbit commented 1 year ago

OS: Arch Linux Kernel: x86_64 Linux 6.5.3-arch1-1 GCC: 13.2.1 20230801

cainbit commented 1 year ago
M17Utils.cpp: In static member function ‘static void CM17Utils::encodeCallsign(const std::string&, unsigned char*)’:
M17Utils.cpp:49:9: error: ‘uint64_t’ was not declared in this scope
   49 |         uint64_t enc = 0ULL;
      |         ^~~~~~~~
M17Utils.cpp:23:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
   22 | #include <cassert>
  +++ |+#include <cstdint>
   23 | 
M17Utils.cpp:55:17: error: ‘enc’ was not declared in this scope
   55 |                 enc *= 40ULL;
      |                 ^~~
M17Utils.cpp:59:24: error: ‘enc’ was not declared in this scope
   59 |         encoded[0U] = (enc >> 40) & 0xFFU;
      |                        ^~~
M17Utils.cpp: In static member function ‘static void CM17Utils::decodeCallsign(const unsigned char*, std::string&)’:
M17Utils.cpp:79:9: error: ‘uint64_t’ was not declared in this scope
   79 |         uint64_t enc =
      |         ^~~~~~~~
M17Utils.cpp:79:9: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
M17Utils.cpp:87:13: error: ‘enc’ was not declared in this scope
   87 |         if (enc >= 262144000000000ULL)  // 40^9
      |             ^~~
M17Utils.cpp:90:16: error: ‘enc’ was not declared in this scope
   90 |         while (enc > 0ULL) {
      |                ^~~
make: *** [Makefile:29: M17Utils.o] Error 1