expected identifier before numeric constant

论坛 期权论坛 脚本     
匿名技术用户   2021-1-7 06:31   11   0
1、

当有下列语句时将出现此状况

  1. printf("\n\t\tSales as percentage of inventory:\t\t%f".\
  2. 100*((float)total_cars_sold[brand]/(float)
  3. cars_in_stock[brand]));

57:7: error: expected identifier before numeric constant

原因是\前的不是, 误写成了.

2、

原因:定义的enum结构体与其它处的宏定义有冲突。

比如

a.h中:

....

#define TRUE 1

.....

b.h中:

.....

typedef enum
{
FALSE=0,
TRUE=1
}bool;

.....

x.c中:

#include "a.h"

#include "b.h"

.....

编译x.c文件会出现上述错误


分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP