我按照编译多个源文件那个小节的说明做,最后出现了这个错误,我能够看懂错误提示,但是觉得这个错误很莫名其妙。。。。
错误如下:
root@jack-Aspire-4740:/home/jack/scripts# gcc -Wall hello.c hello_fn.c -o hello
hello.c: In function ‘hello’:
hello.c:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
hello.c:6: error: expected ‘{’ at end of input
hello_fn.c: In function ‘hello’:
hello_fn.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
hello_fn.c:6: error: expected ‘{’ at end of input
代码
hello.c
代码: 全选
#include "hello.h"
int main(void)
{
hello ("world");
return 0;
}
代码: 全选
#include <stdio.h>
#include "hello.h"
void hello (const char * name)
{
printf ("Hello, %s!\n", name);
}
代码: 全选
void hello (const char * name);
不知道怎么改,来求助= =