当前位置: 技术问答>linux和unix
关于头文件的简单问题~~~~~~~~
来源: 互联网 发布时间:2015-09-04
本文导语: 一个简单程序,分别有三个程序helper.c helper.h howdy.c , 程序如下 /* * helper.c ---helper.c is howdy's function */ #include void msg (void) { printf ("This message sent from msg() functionn"); } /* * helper.h --- helpe...
一个简单程序,分别有三个程序helper.c helper.h howdy.c , 程序如下
/*
* helper.c ---helper.c is howdy's function
*/
#include
void msg (void)
{
printf ("This message sent from msg() functionn");
}
/*
* helper.h --- helper.h for helper.c
*/
void msg (void)
/*
* howdy.c --- modifed "hello programming" program
*/
#include
#include "helper.h"
int main (void)
{
printf ("hello linux programming form howdy.cn");
msg();
return 0;
}
执行命令gcc helper.c howdy -o howdy 后产生错误
howdy.c: In function `msg':
howdy.c:9: parse error before '{' token
howdy.c:9: declaration for parameter `main' but no such parameter
howdy.c:13: number of arguments doesn't match prototype
cc1: prototype declaration
后来尝试单独编译几个文件依然出现这样的错误提示.
请大家指点一二... 多谢多谢
/*
* helper.c ---helper.c is howdy's function
*/
#include
void msg (void)
{
printf ("This message sent from msg() functionn");
}
/*
* helper.h --- helper.h for helper.c
*/
void msg (void)
/*
* howdy.c --- modifed "hello programming" program
*/
#include
#include "helper.h"
int main (void)
{
printf ("hello linux programming form howdy.cn");
msg();
return 0;
}
执行命令gcc helper.c howdy -o howdy 后产生错误
howdy.c: In function `msg':
howdy.c:9: parse error before '{' token
howdy.c:9: declaration for parameter `main' but no such parameter
howdy.c:13: number of arguments doesn't match prototype
cc1: prototype declaration
后来尝试单独编译几个文件依然出现这样的错误提示.
请大家指点一二... 多谢多谢
|
helper.h 文件里,
void msg (void) 后面,好像缺个分号吧?
void msg (void) 后面,好像缺个分号吧?