求救 C:KYE.C(17): error C267: 多个文件调用一个数组的问题

2020-02-04 09:36发布

C:KYE.C(17): error C267: 'update_pca9635': requires ANSI-style prototype
在main.c中的主函数外定义了一个数组。
unsigned char code ab[]={0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X00,0X00,0X00,0X00,0X00,0X01,0X00,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X00,0X01,0X00,0X01,0X00,0X01,0X00,0X01,0X01,0X01,0X01,0X00,0X01,0X01,0X01,0X00,0X01,0X00,0X01,0X00,0X01,0X00,0X01,0X00,0X01,0X00,0X01,······

void main(void)
{
  init_pca9635();
   pause();
          update_pca9635(ab); 这里报C:KYE.C(17): error C267
while(1);
}
===========================================================
update_pca9635(ab);定义在另一个  c文件中 。并且这个文件使用了extern code ab[];



void update_pca9635(unsigned char pic[])
{
        unsigned char n;
        start_i2c();
                SendByte_init(0xe0);
                SendByte_init(0xa2);
                SendByte_init(0x81);
                SendByte_init(0x05);
                         for(n=0;n<201;n=n+8)                  
              {
           SendByte(pic[n+0],pic[n+1],pic[n+2],pic[n+3],pic[n+4],pic[n+5],pic[n+6],pic[n+7]);       
                }
        stop_i2c();
}

大侠们看看问题在哪里···
要是把代码写到一个c文件就不会报错
在线等那
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
9条回答
Pony279
1楼-- · 2020-02-04 13:07
extern code ab[];     类型呢?

update_pca9635 函数有没有在main.c文件里声明?
songcs3
2楼-- · 2020-02-04 14:30
回复【1楼】Pony279 Pony279
-----------------------------------------------------------------------

加了类型也通不过··
在h文件里面声明了。  main.c 引用的h文件
、】
Pony279
3楼-- · 2020-02-04 17:37
 精彩回答 2  元偷偷看……
songcs3
4楼-- · 2020-02-04 19:24
回复【3楼】Pony279 Pony279
-----------------------------------------------------------------------

马上
songcs3
5楼-- · 2020-02-04 22:20
点击此处下载 ourdev_721996KAJ99P.zip(文件大小:3K) (原文件名:timer0.zip)
Pony279
6楼-- · 2020-02-05 01:38
kye.c(5): warning C318: can't open file 'pca_9635.h'

#include "pca_9635.h"

实际头文件 pca9635.h

一个警告都不要放过。。。

一周热门 更多>