X-Ryl669 / eMQTT5

An embedded MQTTv5 client in C++ with minimal footprint, maximal performance
MIT License
65 stars 14 forks source link

Linux specific int types #18

Closed mf01 closed 7 months ago

mf01 commented 8 months ago

in LinuxSpecific.cpp [0] I have to change the typedef, otherwise it will not compile:

    typedef uint32_t __u32;         /* hack to avoid including kernel header in userspace */
    typedef uint16_t __u16;         /* ditto */
    typedef uint8_t __u8;           /* ditto */
    // For camir version of #include <linux/ethtool.h>
    typedef uint32_t  u32;            /* hack to avoid including kernel header in userspace */
    typedef uint16_t  u16;            /* ditto */
    typedef uint8_t   u8;             /* ditto */
    typedef uint64_t  u64;            /* ditto */

[0] https://github.com/X-Ryl669/eMQTT5/blob/e54342c4b59a052ea5ca317eeab8b57fb854e648/tests/ClassPath/src/LinuxSpecific.cpp#L11

X-Ryl669 commented 8 months ago

I'm developing on Linux and I had no issue so far with any kernel version from 3.0 to 6.5.

Can you be more specific about the error message ? What is the platform you're building on, is it linux, 32bits ? 64bits? cross-compiler? and what version?

mf01 commented 8 months ago

I build with cmake and g++ on alpine 3.19 inside of docker (x86_64)

eMQTT5/tests/ClassPath/src/LinuxSpecific.cpp:11:13: error: '__uint32_t' does not name a type; did you mean 'uint32_t'?
   11 |     typedef __uint32_t __u32;         /* hack to avoid including kernel header in userspace */
      |             ^~~~~~~~~~
      |             uint32_t
eMQTT5/tests/ClassPath/src/LinuxSpecific.cpp:12:13: error: '__uint16_t' does not name a type; did you mean 'uint16_t'?
   12 |     typedef __uint16_t __u16;         /* ditto */

Renaming __uint32_t to uint32_t solves my issue.

X-Ryl669 commented 7 months ago

I believe this is fixed in the latest head of the repository. Feel free to reopen if it's not.