Skip to content

Latest commit

 

History

History
75 lines (57 loc) · 1.62 KB

File metadata and controls

75 lines (57 loc) · 1.62 KB

编译问题修复说明

问题1: public.h 中的 typedef bit bool

错误信息:

lib/public.h:9: error 1: Syntax error, declaration ignored at 'bit'
lib/public.h:9: syntax error: token -> 'bool' ; column 16

根本原因: SDCC编译器不支持 typedef bit bool; 这种类型定义

解决方案: 移除该行代码

修改文件: lib/public.h

  • 移除: typedef bit bool;

问题2: timer.h 中的返回类型声明错误

错误信息:

lib/timer.h:13: warning 278: return type of function omitted, assuming int
lib/timer.h:13: error 1: Syntax error, declaration ignored at 'bit'
lib/timer.h:13: syntax error: token -> 'is_countdown_active' ; column 23

根本原因: SDCC编译器不允许函数返回 bit 类型

解决方案: 将函数返回类型改为 unsigned char

修改内容:

文件: lib/timer.h 第13行

修改前:

bit is_countdown_active(void);  // ❌ 不支持

修改后:

unsigned char is_countdown_active(void);  // ✅ 兼容

文件: src/timer.c 第219行

修改前:

bit is_countdown_active(void)  // ❌ 不支持
{
	return countdown_active;
}

修改后:

unsigned char is_countdown_active(void)  // ✅ 兼容
{
	return countdown_active;
}

总结

所有SDCC编译器不兼容的代码已修复:

  • ✅ 移除了不兼容的 typedef bit bool
  • ✅ 函数返回类型改为 unsigned char
  • ✅ 功能完全保留,仅改变返回类型表达方式

验证

编译器将不再报错,所有源文件可以正确编译。


修复时间: 2025年11月20日 状态: ✅ 已修复