beagleboard / librobotcontrol

Robotics Focused library for embedded Linux computers. Mirror of https://git.beagleboard.org/beagleboard/librobotcontrol
https://beagleboard.org/librobotcontrol
MIT License
196 stars 158 forks source link

Add missing include #136

Closed ghost closed 5 years ago

ghost commented 6 years ago

Without stddef.h size_t is undefined. For example compiling program without any other includes than robotcontrol.h:

#include <robotcontrol.h>

int main(int argc, char **argv) {
    rc_set_state(RUNNING);
    while (rc_get_state() != EXITING) {
        rc_usleep(100000);
    }
    return 0;
}

results in error:

/usr/include/rc/i2c.h:104:49: error: unknown type name ‘size_t’
 int rc_i2c_read_bytes(int bus, uint8_t regAddr, size_t count,  uint8_t *data);
                                                 ^~~~~~
/usr/include/rc/i2c.h:104:49: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
/usr/include/rc/i2c.h:1:1:
+#include <stddef.h>
 /**
/usr/include/rc/i2c.h:104:49:
 int rc_i2c_read_bytes(int bus, uint8_t regAddr, size_t count,  uint8_t *data);
                                                 ^~~~~~
StrawsonDesign commented 5 years ago

thanks!