Search code examples
c++clinuxcygwin

Compile time Error in C


I am tring to compile an C code (davinci_spi.c). the corresponding header file is as follow:

davinci_spi.h:

    #ifndef _DAVINCI_SPI_H_
    #define _DAVINCI_SPI_H_

    struct davinci_spi_regs {
    dv_reg  gcr0;       /* 0x00 */
    dv_reg  gcr1;       /* 0x04 */
    dv_reg  int0;       /* 0x08 */
    dv_reg  lvl;        /* 0x0c */
    dv_reg  flg;        /* 0x10 */
    dv_reg  pc0;        /* 0x14 */
    dv_reg  pc1;        /* 0x18 */
    dv_reg  pc2;        /* 0x1c */
    dv_reg  pc3;        /* 0x20 */
    dv_reg  pc4;        /* 0x24 */
    dv_reg  pc5;        /* 0x28 */
    dv_reg  rsvd[3];
    dv_reg  dat0;       /* 0x38 */
    dv_reg  dat1;       /* 0x3c */
    dv_reg  buf;        /* 0x40 */
    dv_reg  emu;        /* 0x44 */
    dv_reg  delay;      /* 0x48 */
    dv_reg  def;        /* 0x4c */
    dv_reg  fmt0;       /* 0x50 */
    dv_reg  fmt1;       /* 0x54 */
    dv_reg  fmt2;       /* 0x58 */
    dv_reg  fmt3;       /* 0x5c */
    dv_reg  intvec0;    /* 0x60 */
    dv_reg  intvec1;    /* 0x64 */
    };

` (I think remaining of file code is not important so not including them)

and when I am trying to compile davinci_spi.c I get this error:


In file included from D:/android/android/myprojects/test1/jni/davinci_spi.c:32:
D:/android/android/myprojects/test1/jni/davinci_spi.h:6: error: expected specifier-qualifier-list before 'dv_reg'

Note: I am using cygwin(with a C/C++ compiler added) and davinci_spi.c is a simple linux driver


Solution

  • I bet that dv_reg is not being defined. Be sure to include the header file that defines the type dv_reg.