当前位置: 技术问答>linux和unix
简单的C程序问题,请教了,谢谢
来源: 互联网 发布时间:2015-05-10
本文导语: 写了三个文件如下: /*helper.c*/ #include void msg(void) { printf("This message is sent from Jupiter.n"); } /*helper.h*/ void msg(void) /*howdy.c*/ #include #include "helper.h" int main(void) { printf("Hello,world!n"); msg(); return 0; } 编译时出现如...
写了三个文件如下:
/*helper.c*/
#include
void msg(void)
{
printf("This message is sent from Jupiter.n");
}
/*helper.h*/
void msg(void)
/*howdy.c*/
#include
#include "helper.h"
int main(void)
{
printf("Hello,world!n");
msg();
return 0;
}
编译时出现如下错误:
howdy.c:In function 'msg':
howdy.c:5:warning: 'main' is usually a function
howdy.c:5:parse error before '{' token
howdy.c:5: declaration for parameter 'main' but no such parameter
howdy.c:7: number of arguments doesn't match prototype
cc1: prototypr declaration
新手上路,大家多指点,谢谢!
/*helper.c*/
#include
void msg(void)
{
printf("This message is sent from Jupiter.n");
}
/*helper.h*/
void msg(void)
/*howdy.c*/
#include
#include "helper.h"
int main(void)
{
printf("Hello,world!n");
msg();
return 0;
}
编译时出现如下错误:
howdy.c:In function 'msg':
howdy.c:5:warning: 'main' is usually a function
howdy.c:5:parse error before '{' token
howdy.c:5: declaration for parameter 'main' but no such parameter
howdy.c:7: number of arguments doesn't match prototype
cc1: prototypr declaration
新手上路,大家多指点,谢谢!
|
/*helper.h*/
void msg(void)
;号呢???
同时应该在helper.c中加上#include "helper.h"
void msg(void)
;号呢???
同时应该在helper.c中加上#include "helper.h"