我尝试制作自己的头文件,但它并不起作用,
vim
提示错误。wget.h:2:2: error: invalid preprocessing directive #ifndef__WGET_H__
wget.h:3:2: error: invalid preprocessing directive #define__WGET_H__
wget.h:7:2: error: #endif without #if
我的代码是这样的:
//wget header file
#ifndef__WGET_H__
#define__WGET_H__
int my_wget (char web_address[]);
#endif /*__WGET_H__*/
对我来说看起来没问题(我读过的例子和我的很相似),但我不知道出了什么问题。有什么想法吗?
#ifndef
)和标记之间加上一个空格,以定义/检查该符号。 - Joe__WGET_H__
更改为WGET_H_
。标识符中的任何双下划线,或者以下划线开头后跟大写字符的标识符都被实现保留。您的符号违反了这两个规则。 - Praetorian