Forum | Documentation | Website | Blog

Skip to content

Add missing include

Jason Kridner requested to merge github/fork/kikaitachi/patch-3 into master

Created by: ghost

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);
                                                 ^~~~~~

Merge request reports