[i2c] I2C: Getting Compiation Error for application program

Jean Delvare khali at linux-fr.org
Thu Sep 21 08:03:19 CEST 2006


Hi Sachin,

> Sorry for incomplete problem description (without error log).
>  
> The error list was huge and I fell it is unappropiate
> to send it as an attachment on mailing list.
> (I didn't want to load the Inbox of the mailing list member).

I certainly appreciate the intention :) But we also need the
information to help you, so ideally you should have copied the 10 or 20
first lines of error. From there we should be able to find out what was
wrong and provide some guidance.

> I am attaching the error log file for reference.

> -bash-2.05b# gcc eeprom-client.c
> In file included from /usr/include/asm/div64.h:1,
>                  from /usr/include/linux/jiffies.h:9,
>                  from /usr/include/linux/sched.h:12,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/asm-generic/div64.h:54:3: #error do_div() does not yet support the C64
> In file included from /usr/include/linux/sched.h:12,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/jiffies.h:84: error: parse error before "jiffies_64"
> /usr/include/linux/jiffies.h:88: error: parse error before "get_jiffies_64"
> In file included from /usr/include/linux/sched.h:12,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h:213:31: division by zero in #if
> /usr/include/linux/jiffies.h: In function `timespec_to_jiffies':
> /usr/include/linux/jiffies.h:318: error: `CLOCK_TICK_RATE' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:318: error: (Each undeclared identifier is reported only once
> /usr/include/linux/jiffies.h:318: error: for each function it appears in.)
> /usr/include/linux/jiffies.h:320: error: called object is not a function
> /usr/include/linux/jiffies.h:320: error: called object is not a function
> /usr/include/linux/jiffies.h:320: error: `NSEC_PER_SEC' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:321: error: called object is not a function
> /usr/include/linux/jiffies.h:321: error: called object is not a function
> /usr/include/linux/jiffies.h:324: error: parse error before "sec"
> /usr/include/linux/jiffies.h:324: error: parse error before "NSEC_PER_SEC"
> /usr/include/linux/jiffies.h:324: error: called object is not a function
> /usr/include/linux/jiffies.h:324: error: parse error before ')' token
> /usr/include/linux/jiffies.h: In function `jiffies_to_timespec':
> /usr/include/linux/jiffies.h:337: error: parse error before "nsec"
> /usr/include/linux/jiffies.h:338: error: parse error before "result"
> /usr/include/linux/jiffies.h:338: error: `result' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:338: error: `NSEC_PER_SEC' undeclared (first use in this function)
> /usr/include/linux/jiffies.h: In function `timeval_to_jiffies':
> /usr/include/linux/jiffies.h:359: error: called object is not a function
> /usr/include/linux/jiffies.h:359: error: `CLOCK_TICK_RATE' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:359: error: called object is not a function
> /usr/include/linux/jiffies.h:359: error: `NSEC_PER_SEC' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:360: error: called object is not a function
> /usr/include/linux/jiffies.h:360: error: called object is not a function
> /usr/include/linux/jiffies.h:363: error: parse error before "sec"
> /usr/include/linux/jiffies.h:363: error: parse error before "NSEC_PER_SEC"
> /usr/include/linux/jiffies.h:363: error: called object is not a function
> /usr/include/linux/jiffies.h:363: error: parse error before ')' token
> /usr/include/linux/jiffies.h: In function `jiffies_to_timeval':
> /usr/include/linux/jiffies.h:375: error: parse error before "nsec"
> /usr/include/linux/jiffies.h:376: error: parse error before "result"
> /usr/include/linux/jiffies.h:376: error: `result' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:376: error: `NSEC_PER_SEC' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:377: error: `NSEC_PER_USEC' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:6: division by zero in #if
> /usr/include/linux/jiffies.h:385:41: division by zero in #if
> /usr/include/linux/jiffies.h:385:42: division by zero in #if
> /usr/include/linux/jiffies.h: In function `jiffies_to_clock_t':
> /usr/include/linux/jiffies.h:388: error: parse error before "tmp"
> /usr/include/linux/jiffies.h:389: error: `tmp' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:389: error: `NSEC_PER_SEC' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:389: error: `USER_HZ' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:396:18: division by zero in #if
> /usr/include/linux/jiffies.h: In function `clock_t_to_jiffies':
> /usr/include/linux/jiffies.h:401: error: parse error before "jif"
> /usr/include/linux/jiffies.h:404: error: `USER_HZ' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:408: error: `jif' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:408: error: parse error before numeric constant
> /usr/include/linux/jiffies.h: At top level:
> /usr/include/linux/jiffies.h:414: error: parse error before "jiffies_64_to_clock_t"
> /usr/include/linux/jiffies.h:414: error: parse error before "x"
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:6: division by zero in #if
> /usr/include/linux/jiffies.h:416:41: division by zero in #if
> /usr/include/linux/jiffies.h:416:42: division by zero in #if
> /usr/include/linux/jiffies.h: In function `jiffies_64_to_clock_t':
> /usr/include/linux/jiffies.h:424: error: `x' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:424: error: `CLOCK_TICK_RATE' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:425: error: `NSEC_PER_SEC' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:425: error: `USER_HZ' undeclared (first use in this function)
> /usr/include/linux/jiffies.h: At top level:
> /usr/include/linux/jiffies.h:430: error: parse error before "nsec_to_clock_t"
> /usr/include/linux/jiffies.h:430: error: parse error before "x"
> /usr/include/linux/jiffies.h:432:28: division by zero in #if
> /usr/include/linux/jiffies.h: In function `nsec_to_clock_t':
> /usr/include/linux/jiffies.h:433: error: `x' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:433: error: `NSEC_PER_SEC' undeclared (first use in this function)
> /usr/include/linux/jiffies.h:433: error: `USER_HZ' undeclared (first use in this function)
> In file included from /usr/include/linux/cpumask.h:78,
>                  from /usr/include/linux/sched.h:15,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/bitmap.h: In function `bitmap_zero':
> /usr/include/linux/bitmap.h:113: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_fill':
> /usr/include/linux/bitmap.h:128: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_copy':
> /usr/include/linux/bitmap.h:134: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_and':
> /usr/include/linux/bitmap.h:145: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_or':
> /usr/include/linux/bitmap.h:154: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_xor':
> /usr/include/linux/bitmap.h:163: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_andnot':
> /usr/include/linux/bitmap.h:172: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_complement':
> /usr/include/linux/bitmap.h:181: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_equal':
> /usr/include/linux/bitmap.h:190: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_intersects':
> /usr/include/linux/bitmap.h:199: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_subset':
> /usr/include/linux/bitmap.h:208: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_empty':
> /usr/include/linux/bitmap.h:216: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_full':
> /usr/include/linux/bitmap.h:224: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_shift_right':
> /usr/include/linux/bitmap.h:238: error: `BITS_PER_LONG' undeclared (first use in this function)
> /usr/include/linux/bitmap.h: In function `bitmap_shift_left':
> /usr/include/linux/bitmap.h:247: error: `BITS_PER_LONG' undeclared (first use in this function)
> In file included from /usr/include/linux/sched.h:15,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:81: error: parse error before "DECLARE_BITMAP"
> /usr/include/linux/cpumask.h:82: error: parse error before "_unused_cpumask_arg_"
> /usr/include/linux/cpumask.h:85: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpu_set':
> /usr/include/linux/cpumask.h:87: error: `cpu' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:87: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:91: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpu_clear':
> /usr/include/linux/cpumask.h:93: error: `cpu' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:93: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:97: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_setall':
> /usr/include/linux/cpumask.h:99: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:99: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:103: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_clear':
> /usr/include/linux/cpumask.h:105: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:105: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:112: error: parse error before "cpumask_t"
> /usr/include/linux/cpumask.h: In function `__cpu_test_and_set':
> /usr/include/linux/cpumask.h:114: error: `cpu' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:114: error: `addr' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:118: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_and':
> /usr/include/linux/cpumask.h:121: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:121: error: `src1p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:121: error: `src2p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:121: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:125: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_or':
> /usr/include/linux/cpumask.h:128: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:128: error: `src1p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:128: error: `src2p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:128: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:132: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_xor':
> /usr/include/linux/cpumask.h:135: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:135: error: `src1p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:135: error: `src2p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:135: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:140: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_andnot':
> /usr/include/linux/cpumask.h:143: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:143: error: `src1p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:143: error: `src2p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:143: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:147: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_complement':
> /usr/include/linux/cpumask.h:150: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:150: error: `srcp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:150: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:154: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_equal':
> /usr/include/linux/cpumask.h:157: error: `src1p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:157: error: `src2p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:157: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:161: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_intersects':
> /usr/include/linux/cpumask.h:164: error: `src1p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:164: error: `src2p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:164: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:168: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_subset':
> /usr/include/linux/cpumask.h:171: error: `src1p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:171: error: `src2p' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:171: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:175: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_empty':
> /usr/include/linux/cpumask.h:177: error: `srcp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:177: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:181: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_full':
> /usr/include/linux/cpumask.h:183: error: `srcp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:183: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:187: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_weight':
> /usr/include/linux/cpumask.h:189: error: `srcp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:189: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:194: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_shift_right':
> /usr/include/linux/cpumask.h:197: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:197: error: `srcp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:197: error: `n' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:197: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:202: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpus_shift_left':
> /usr/include/linux/cpumask.h:205: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:205: error: `srcp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:205: error: `n' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:205: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:209: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__first_cpu':
> /usr/include/linux/cpumask.h:211: error: parse error before "int"
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:215: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__next_cpu':
> /usr/include/linux/cpumask.h:217: error: parse error before "int"
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:266: error: parse error before '*' token
> /usr/include/linux/cpumask.h: In function `__cpumask_scnprintf':
> /usr/include/linux/cpumask.h:268: error: `buf' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:268: error: `len' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:268: error: `srcp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:268: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:274: error: parse error before "cpumask_t"
> /usr/include/linux/cpumask.h: In function `__cpumask_parse':
> /usr/include/linux/cpumask.h:276: error: `buf' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:276: error: `len' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:276: error: `dstp' undeclared (first use in this function)
> /usr/include/linux/cpumask.h:276: error: `nbits' undeclared (first use in this function)
> /usr/include/linux/cpumask.h: At top level:
> /usr/include/linux/cpumask.h:344: error: parse error before "cpu_possible_map"
> /usr/include/linux/cpumask.h:345: error: parse error before "cpu_online_map"
> /usr/include/linux/cpumask.h:346: error: parse error before "cpu_present_map"
> In file included from /usr/include/asm/cputime.h:4,
>                  from /usr/include/linux/sched.h:23,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/asm-generic/cputime.h:21: error: parse error before "cputime64_t"
> In file included from /usr/include/linux/signal.h:4,
>                  from /usr/include/linux/sched.h:27,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/list.h:705:2: warning: #warning "don't include kernel headers in userspace"
> In file included from /usr/include/linux/signal.h:5,
>                  from /usr/include/linux/sched.h:27,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/spinlock.h: In function `bit_spin_unlock':
> /usr/include/linux/spinlock.h:579: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
> /usr/include/linux/spinlock.h: In function `bit_spin_is_locked':
> /usr/include/linux/spinlock.h:591: error: invalid type argument of `->'
> In file included from /usr/include/linux/sched.h:31,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/completion.h: At top level:
> /usr/include/linux/completion.h:15: error: parse error before "wait_queue_head_t"
> /usr/include/linux/completion.h: In function `init_completion':
> /usr/include/linux/completion.h:26: error: dereferencing pointer to incomplete type
> /usr/include/linux/completion.h:27: error: dereferencing pointer to incomplete type
> In file included from /usr/include/linux/sched.h:32,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/pid.h: At top level:
> /usr/include/linux/pid.h:17: error: field `pid_chain' has incomplete type
> /usr/include/linux/pid.h:19: error: field `pid_list' has incomplete type
> In file included from /usr/include/linux/sched.h:33,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/percpu.h: In function `__alloc_percpu':
> /usr/include/linux/percpu.h:45: error: `GFP_KERNEL' undeclared (first use in this function)
> In file included from /usr/include/linux/sched.h:102,
>                  from /usr/include/linux/module.h:10,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/timer.h: At top level:
> /usr/include/linux/timer.h:12: error: field `entry' has incomplete type
> In file included from /usr/include/linux/hardirq.h:5,
>                  from /usr/include/asm-generic/local.h:6,
>                  from /usr/include/asm/local.h:4,
>                  from /usr/include/linux/module.h:21,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/smp_lock.h: In function `reacquire_kernel_lock':
> /usr/include/linux/smp_lock.h:37: error: dereferencing pointer to incomplete type
> In file included from /usr/include/asm/local.h:4,
>                  from /usr/include/linux/module.h:21,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/asm-generic/local.h: In function `local_inc':
> /usr/include/asm-generic/local.h:65: error: invalid type argument of `->'
> /usr/include/asm-generic/local.h:65: error: invalid type argument of `->'
> /usr/include/asm-generic/local.h:66: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
> /usr/include/asm-generic/local.h: In function `local_dec':
> /usr/include/asm-generic/local.h:72: error: invalid type argument of `->'
> /usr/include/asm-generic/local.h:72: error: invalid type argument of `->'
> /usr/include/asm-generic/local.h:73: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
> /usr/include/asm-generic/local.h: In function `local_add':
> /usr/include/asm-generic/local.h:79: error: invalid type argument of `->'
> /usr/include/asm-generic/local.h:79: error: invalid type argument of `->'
> /usr/include/asm-generic/local.h:80: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
> /usr/include/asm-generic/local.h: In function `local_sub':
> /usr/include/asm-generic/local.h:86: error: invalid type argument of `->'
> /usr/include/asm-generic/local.h:86: error: invalid type argument of `->'
> /usr/include/asm-generic/local.h:87: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
> In file included from /usr/include/linux/module.h:23,
>                  from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/asm/module.h: At top level:
> /usr/include/asm/module.h:28: error: field `bug_list' has incomplete type
> In file included from /usr/include/linux/i2c.h:31,
>                  from eeprom-client.c:1:
> /usr/include/linux/module.h:50: error: field `attr' has incomplete type
> /usr/include/linux/module.h:58: error: field `kobj' has incomplete type
> /usr/include/linux/module.h:213: error: requested alignment is not a constant
> /usr/include/linux/module.h:233: error: field `grp' has incomplete type
> /usr/include/linux/module.h:244: error: field `list' has incomplete type
> /usr/include/linux/module.h:296: error: field `modules_which_use_me' has incomplete type
> /usr/include/linux/module.h: In function `__module_get':
> /usr/include/linux/module.h:364: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
> /usr/include/linux/module.h: In function `try_module_get':
> /usr/include/linux/module.h:378: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
> /usr/include/linux/module.h: In function `module_put':
> /usr/include/linux/module.h:391: error: `TIF_NEED_RESCHED' undeclared (first use in this function)
> In file included from /usr/include/linux/i2c.h:34,
>                  from eeprom-client.c:1:
> /usr/include/linux/device.h: At top level:
> /usr/include/linux/device.h:53: error: field `subsys' has incomplete type
> /usr/include/linux/device.h:54: error: field `drivers' has incomplete type
> /usr/include/linux/device.h:55: error: field `devices' has incomplete type
> /usr/include/linux/device.h:64: error: parse error before "pm_message_t"
> /usr/include/linux/device.h:90: error: field `attr' has incomplete type
> /usr/include/linux/device.h:105: error: field `unload_sem' has incomplete type
> /usr/include/linux/device.h:106: error: field `kobj' has incomplete type
> /usr/include/linux/device.h:107: error: field `devices' has incomplete type
> /usr/include/linux/device.h:114: error: parse error before "u32"
> /usr/include/linux/device.h:115: error: parse error before "u32"
> /usr/include/linux/device.h:130: error: field `attr' has incomplete type
> /usr/include/linux/device.h:148: error: field `subsys' has incomplete type
> /usr/include/linux/device.h:149: error: field `children' has incomplete type
> /usr/include/linux/device.h:150: error: field `interfaces' has incomplete type
> /usr/include/linux/device.h:170: error: field `attr' has incomplete type
> /usr/include/linux/device.h:183: error: field `node' has incomplete type
> /usr/include/linux/device.h:185: error: field `kobj' has incomplete type
> /usr/include/linux/device.h:190: error: `KOBJ_NAME_LEN' undeclared here (not in a function)
> /usr/include/linux/device.h:218: error: field `attr' has incomplete type
> /usr/include/linux/device.h:237: error: field `node' has incomplete type
> /usr/include/linux/device.h:258: error: field `node' has incomplete type
> /usr/include/linux/device.h:259: error: field `bus_list' has incomplete type
> /usr/include/linux/device.h:260: error: field `driver_list' has incomplete type
> /usr/include/linux/device.h:261: error: field `children' has incomplete type
> /usr/include/linux/device.h:264: error: field `kobj' has incomplete type
> /usr/include/linux/device.h:273: error: field `power' has incomplete type
> /usr/include/linux/device.h:275: error: parse error before "u32"
> /usr/include/linux/device.h:279: error: parse error before "coherent_dma_mask"
> /usr/include/linux/device.h:291: error: parse error before '}' token
> /usr/include/linux/device.h: In function `list_to_dev':
> /usr/include/linux/device.h:296: error: parse error before "struct"
> /usr/include/linux/device.h: In function `dev_get_drvdata':
> /usr/include/linux/device.h:302: error: dereferencing pointer to incomplete type
> /usr/include/linux/device.h: In function `dev_set_drvdata':
> /usr/include/linux/device.h:308: error: dereferencing pointer to incomplete type
> /usr/include/linux/device.h: At top level:
> /usr/include/linux/device.h:336: error: field `attr' has incomplete type
> /usr/include/linux/device.h:372: error: parse error before "u32"
> /usr/include/linux/device.h:374: error: parse error before "num_resources"
> /usr/include/linux/device.h:376: error: parse error before '}' token
> In file included from eeprom-client.c:1:
> /usr/include/linux/i2c.h:74: error: parse error before "i2c_smbus_xfer"
> /usr/include/linux/i2c.h:74: error: parse error before "u16"
> /usr/include/linux/i2c.h:82: error: parse error before "i2c_smbus_write_quick"
> /usr/include/linux/i2c.h:82: error: parse error before "u8"
> /usr/include/linux/i2c.h:83: error: parse error before "i2c_smbus_read_byte"
> /usr/include/linux/i2c.h:84: error: parse error before "i2c_smbus_write_byte"
> /usr/include/linux/i2c.h:84: error: parse error before "u8"
> /usr/include/linux/i2c.h:85: error: parse error before "i2c_smbus_read_byte_data"
> /usr/include/linux/i2c.h:85: error: parse error before "u8"
> /usr/include/linux/i2c.h:86: error: parse error before "i2c_smbus_write_byte_data"
> /usr/include/linux/i2c.h:87: error: parse error before "u8"
> /usr/include/linux/i2c.h:88: error: parse error before "i2c_smbus_read_word_data"
> /usr/include/linux/i2c.h:88: error: parse error before "u8"
> /usr/include/linux/i2c.h:89: error: parse error before "i2c_smbus_write_word_data"
> /usr/include/linux/i2c.h:90: error: parse error before "u8"
> /usr/include/linux/i2c.h:92: error: parse error before "i2c_smbus_write_block_data"
> /usr/include/linux/i2c.h:93: error: parse error before "u8"
> /usr/include/linux/i2c.h:95: error: parse error before "i2c_smbus_read_i2c_block_data"
> /usr/include/linux/i2c.h:96: error: parse error before "u8"
> /usr/include/linux/i2c.h:133: error: field `list' has incomplete type
> /usr/include/linux/i2c.h:159: error: field `dev' has incomplete type
> /usr/include/linux/i2c.h:160: error: field `list' has incomplete type
> /usr/include/linux/i2c.h:162: error: field `released' has incomplete type
> /usr/include/linux/i2c.h:199: error: parse error before "u16"
> /usr/include/linux/i2c.h:211: error: parse error before "u32"
> /usr/include/linux/i2c.h:231: error: field `bus_lock' has incomplete type
> /usr/include/linux/i2c.h:232: error: field `clist_lock' has incomplete type
> /usr/include/linux/i2c.h:236: error: field `dev' has incomplete type
> /usr/include/linux/i2c.h:245: error: field `clients' has incomplete type
> /usr/include/linux/i2c.h:246: error: field `list' has incomplete type
> /usr/include/linux/i2c.h:248: error: field `dev_released' has incomplete type
> /usr/include/linux/i2c.h:249: error: field `class_dev_released' has incomplete type
> /usr/include/linux/i2c.h:377: error: parse error before "i2c_get_functionality"
> /usr/include/linux/i2c.h:380: error: parse error before "u32"

All the above it caused by you including <linux/i2c.h>. As explained
before, this is a kernel-only header file, which you must _not_ include
in user-space code. You are not the only one to blame though, as in
fact this header file should not be in /usr/include at all, this is a
mistake which should be fixed "soon".

> eeprom-client.c: In function `main':
> eeprom-client.c:19: error: `O_RDWR' undeclared (first use in this function)

And this one is because you forgot to add the following at the
beginning of your code:

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

(From "man open".)

> eeprom-client.c: At top level:
> /usr/include/linux/device.h:285: error: storage size of `dma_pools' isn't known
> /usr/include/linux/device.h:373: error: storage size of `dev' isn't known

So the key is to include the right header files. No kernel header,
i2c-dev.h from the lm_sensors project, and any standard header you need
for the functions you use (For example printf requires <stdio.h>, ioctl
requires <sys/ioctl.h>, etc... Use "man <function name>" to find out.)

-- 
Jean Delvare



More information about the i2c mailing list