读书人

c语言头文件有关问题

发布时间: 2012-06-20 20:37:21 作者: rapoo

c语言头文件问题
今天写程序时,遇到一个错误,所以写了下面这个小程序测试一下,有问题!(包含三个文件(main.c,b.c,b.h))

main.c

C/C++ code
#include <stdio.h>#include "b.h"int main(){    OutputYear();    return 0;}


b.h
C/C++ code
#ifndef B_H#define B_Hint year=1991;void OutputYear();#endifb.c[code=C/C++]#include <stdio.h>#include "b.h"void OutputYear(){    printf("The year is : %d\n ",year);}


[/code]

请问大家这个程序为什么错呢?

[解决办法]
探讨
我在b.c中这样写也会报错,这是为什么,它又不是头文件

读书人网 >C语言

热点推荐