头文件
#ifdnef MAX_H
#define_MAX_H_
int com(int a,int b);
#endif
1 In file included from 比较?笮?com().c
1 2 [Error] invalid preprocessing directive #ifdnef; did you mean #ifdef?
7 2 [Error] #endif without #if
2 In file included from ?冉?大?ain().c
1 2 [Error] invalid preprocessing directive #ifdnef; did you mean #ifdef?
7 2 [Error] #endif without #if
33 recipe for target '比?洗?小com().o' failed
30 recipe for target '比较?笮?main().o' failed
首先感谢邀请回答:
关键字写错了
#ifdnef应该是#ifndef
正确写法如下:
#ifndef _MAX_H_
#define _MAX_H_
int com(int a,int b);
#endif
可以理解为:
#ifndef
#define
#endif
如果没有定义XX,那就定义XX,结束if
一般XX是一致的,也就是ifndef---》if not define;那就定义define
你写成#ifdnef了
应该是#ifndef