#*** Using Compiler 'V5.05 update 1 (build 106)', folder: 'D:\keil\ARM\ARMCC\Bin'
compiling main.c..
.\Backup.004\C51\INC\reg51.h(13): error: #20: identifier "sfr" is undefined
sfr P0 = 0x80;
.\Backup.004\C51\INC\reg51.h(14): error: #20: identifier "sfr" is undefined
sfr P1 = 0x90;
.\Backup.004\C51\INC\reg51.h(15): error: #20: identifier "sfr" is undefined
sfr P2 = 0xA0;
.\Backup.004\C51\INC\reg51.h(16): error: #20: identifier "sfr" is undefined
sfr P3 = 0xB0;
.\Backup.004\C51\INC\reg51.h(17): error: #20: identifier "sfr" is undefined
sfr PSW = 0xD0;
.\Backup.004\C51\INC\reg51.h(18): error: #20: identifier "sfr" is undefined
sfr ACC = 0xE0;
.\Backup.004\C51\INC\reg51.h(19): error: #20: identifier "sfr" is undefined
sfr B = 0xF0;
.\Backup.004\C51\INC\reg51.h(20): error: #20: identifier "sfr" is undefined
sfr SP = 0x81;
.\Backup.004\C51\INC\reg51.h(21): error: #20: identifier "sfr" is undefined
sfr DPL = 0x82;
.\Backup.004\C51\INC\reg51.h(22): error: #20: identifier "sfr" is undefined
sfr DPH = 0x83;
.\Backup.004\C51\INC\reg51.h(23): error: #20: identifier "sfr" is undefined
sfr PCON = 0x87;
.\Backup.004\C51\INC\reg51.h(24): error: #20: identifier "sfr" is undefined
sfr TCON = 0x88;
.\Backup.004\C51\INC\reg51.h(25): error: #20: identifier "sfr" is undefined
sfr TMOD = 0x89;
.\Backup.004\C51\INC\reg51.h(26): error: #20: identifier "sfr" is undefined
sfr TL0 = 0x8A;
.\Backup.004\C51\INC\reg51.h(27): error: #20: identifier "sfr" is undefined
sfr TL1 = 0x8B;
.\Backup.004\C51\INC\reg51.h(28): error: #20: identifier "sfr" is undefined
sfr TH0 = 0x8C;
.\Backup.004\C51\INC\reg51.h(29): error: #20: identifier "sfr" is undefined
sfr TH1 = 0x8D;
.\Backup.004\C51\INC\reg51.h(30): error: #20: identifier "sfr" is undefined
sfr IE = 0xA8;
.\Backup.004\C51\INC\reg51.h(31): error: #20: identifier "sfr" is undefined
sfr IP = 0xB8;
.\Backup.004\C51\INC\reg51.h(32): error: #20: identifier "sfr" is undefined
sfr SCON = 0x98;
.\Backup.004\C51\INC\reg51.h(33): error: #20: identifier "sfr" is undefined
sfr SBUF = 0x99;
.\Backup.004\C51\INC\reg51.h(38): error: #20: identifier "sbit" is undefined
sbit CY = 0xD7;
.\Backup.004\C51\INC\reg51.h(39): error: #20: identifier "sbit" is undefined
sbit AC = 0xD6;
.\Backup.004\C51\INC\reg51.h(40): error: #20: identifier "sbit" is undefined
sbit F0 = 0xD5;
.\Backup.004\C51\INC\reg51.h(41): error: #20: identifier "sbit" is undefined
sbit RS1 = 0xD4;
.\Backup.004\C51\INC\reg51.h(42): error: #20: identifier "sbit" is undefined
sbit RS0 = 0xD3;
.\Backup.004\C51\INC\reg51.h(43): error: #20: identifier "sbit" is undefined
sbit OV = 0xD2;
.\Backup.004\C51\INC\reg51.h(44): error: #20: identifier "sbit" is undefined
sbit P = 0xD0;
.\Backup.004\C51\INC\reg51.h(47): error: #20: identifier "sbit" is undefined
sbit TF1 = 0x8F;
.\Backup.004\C51\INC\reg51.h(48): error: #20: identifier "sbit" is undefined
sbit TR1 = 0x8E;
main.c: 0 warnings, 30 errors
"main.c" - 30 Error(s), 0 Warning(s).
你是#include<reg51.h>吗?试下改成 #include "reg51.h" 或#include <REGX51.H>
reg51是51单片机里的头文件,看编译命令行却是ARMCC,报错信息里提到的sfr关键字是C51特有的,ARMCC是不支持的,怎么可能编译通过,新建工程的时候平台就选错了,你到底是要新建个ARM的项目还是51的?