itead / Segnix

An Arduino-like Project Based on Linux/Raspberry Pi
111 stars 74 forks source link

SDK I2C Compilation Problem #2

Open hallard opened 9 years ago

hallard commented 9 years ago

Here is the tip to avoid the following error message (on my Pi B+) according smbus

root@pi04:~/SDK# make make -C lib all make[1]: Entering directory '/root/SDK/lib' make -C c libiteadc.so make[2]: Entering directory '/root/SDK/lib/c' gcc -O2 -fpic -shared -o libiteadc.so *.c -I../../include In file included from itead_wire.c:37:0: /usr/include/linux/i2c-dev.h:38:8: error: redefinition of ‘struct i2c_msg’ /usr/include/linux/i2c.h:68:8: note: originally defined here /usr/include/linux/i2c-dev.h:90:7: error: redefinition of ‘union i2c_smbus_data’ /usr/include/linux/i2c.h:128:7: note: originally defined here

edit the file lib/c/itead_wire.c and comment the line which include linux/i2c.h since I2C definitions are already in i2c-dev.h. It avoid duplication definition at compilation

include <linux/types.h> //#include <linux/i2c.h>

include <linux/i2c-dev.h>

Philipp97714 commented 7 years ago

I think the Segnix library is discontinued.