找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

warning C318: can't open file 'AT24C02.h'单片机编译错误

查看数: 3987 | 评论数: 5 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2020-6-19 12:24

正文摘要:

报错warning C318: can't open file 'AT24C02.h' 这是源程序: #include<reg51.h> #include<at24c02.h> #define uchar unsigned char #define uint unsigned int uchar buffer[6]={0}; sbit sda=P3 ...

回复

ID:636538 发表于 2020-6-22 10:20
lll1472589 发表于 2020-6-20 11:14
还是不行,它就变成这个了:智能锁.c(12): error C309: bad or missing filename

你为什么有两个声明51.h,你在定义AT2402.h中是怎么定义的,给你看一下我在定义i2c.h里面写的内容
#ifndef __I2C_H_
#define __I2C_H_

#include<reg51.h>

//---重定义关键词---//
#ifndef uchar
#define uchar unsigned char
#endif

#ifndef uint
#define uint unsigned int
#endif

//--定义使用的IO口--//
sbit I2C_SCL = P2^1;
sbit I2C_SDA = P2^0;

//--声明全局变量--//
void I2C_Delay10us();
void I2C_Start();
void I2C_Stop();
uchar I2C_SendByte(uchar dat, uchar ack);
uchar I2C_ReadByte();

#endif
ID:277948 发表于 2020-6-20 16:31
option-c/c++ -include path 里面添加试试
ID:367460 发表于 2020-6-20 14:20
你的At24c02 是不是main.c不在一个文件夹啊
ID:777060 发表于 2020-6-20 11:14
SKYLAR123 发表于 2020-6-19 16:17
你把声明#include换成#include "at2402.h"试试

还是不行,它就变成这个了:智能锁.c(12): error C309: bad or missing filename
ID:636538 发表于 2020-6-19 16:17
你把声明#include<at24c02.h>换成#include "at2402.h"试试

小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表