gpt4 book ai didi

c++ - C中的编译时错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:40:01 24 4
gpt4 key购买 nike

我正在尝试编译 C 代码 (davinci_spi.c)。对应的头文件如下:

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 */
};

`(我认为剩余的文件代码并不重要,所以不包括它们)

当我尝试编译 davinci_spi.c 时出现此错误:


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'

注意:我使用的是 cygwin(添加了 C/C++ 编译器),而 davinci_spi.c 是一个简单的 linux 驱动程序

最佳答案

我打赌 dv_reg 没有被定义。请务必包含定义类型 dv_reg 的头文件。

关于c++ - C中的编译时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14566627/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com