Open miky2k opened 9 years ago
Your compiler does not support struct initialisations. You can change you compiler or initialise the "struct gyro_reg_s reg" in the following way: https://github.com/rpicopter/ArduinoMotionSensorExample/blob/master/inv_mpu.cpp#L409
gregd72002 wrote:
Your compiler does not support struct initialisations.
Strange, i use debian wheezy ad it's gcc, there is some flag to enable C99 ?
Miky
Ok i change CXX=g++ to CXX=gcc and now error disappear
As stated here: In ISO C99 you can give the elements in any order, specifying the array indices or structure field names they apply to, and GNU C allows this as an extension in C89 mode as well. This extension is not implemented in GNU C++. https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Designated-Inits.htmll
now it compile but not link:
/tmp/cc5asmQ8.o: In function main': /home/miky/MotionSensorExample/main.c:11: undefined reference to
ms_open'
/home/miky/MotionSensorExample/main.c:13: undefined reference to ms_update' MotionSensor/libMotionSensor.a(sensor.o): In function
ms_open()':
/home/miky/MotionSensorExample/MotionSensor/sensor.c:55: undefined reference to mpu_init(int_param_s*)' /home/miky/MotionSensorExample/MotionSensor/sensor.c:60: undefined reference to
mpu_set_sensors(unsigned char)'
/home/miky/MotionSensorExample/MotionSensor/sensor.c:65: undefined reference to `mpu_set_gyro_fsr(unsigned short)'
Well, the Makefile was written to support g++ only. Since you changed the compiler to gcc, further changes are needed to the Makefile.
Since you now how objects compiled, you can try changing the compiler back to g++ and issue 'make'. It should now invoke only the linker as all the objects are already compiled.
However, the permanent solution should be to convert the self initialised struct in inv_mpu.c into a new function that initialises them as indicated earlier.
Hope this helps.
I clone your example in my cubieboard (armhf board), and giving make i receive this message.
Other projects compile correct.