当前位置: 技术问答>linux和unix
新手刚学vi,有一问题请教,望大家帮帮忙!谢谢
来源: 互联网 发布时间:2016-04-29
本文导语: 我看不懂那个error是什么意思 -bash-3.2$ vi main.c #include "head.h" void main() {test(); printf("hello mainn"); } ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "main.c" 5L, 66C written -bash-3.2$ vi...
我看不懂那个error是什么意思
-bash-3.2$ vi main.c
#include "head.h"
void main()
{test();
printf("hello mainn");
}
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"main.c" 5L, 66C written
-bash-3.2$ vi test.c
#include "head.h"
void test()
{
printf("hello test/n");
}
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"test.c" 6L, 59C written
-bash-3.2$ vi head.h
#ifndef _head_h
#define _head_h
#include (stdio.h)
extern void test ();
#endif
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"head.h" 6L, 80C written
-bash-3.2$ gcc -c main.c
In file included from main.c:1:
head.h:3:10: error: #include expects "FILENAME" or
main.c: In function 鈓ain?
main.c:4: warning: incompatible implicit declaration of built-in function 鈖rintf?
main.c:3: warning: return type of 鈓ain?is not 鈏nt?
-bash-3.2$
-bash-3.2$ vi main.c
#include "head.h"
void main()
{test();
printf("hello mainn");
}
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"main.c" 5L, 66C written
-bash-3.2$ vi test.c
#include "head.h"
void test()
{
printf("hello test/n");
}
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"test.c" 6L, 59C written
-bash-3.2$ vi head.h
#ifndef _head_h
#define _head_h
#include (stdio.h)
extern void test ();
#endif
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"head.h" 6L, 80C written
-bash-3.2$ gcc -c main.c
In file included from main.c:1:
head.h:3:10: error: #include expects "FILENAME" or
main.c: In function 鈓ain?
main.c:4: warning: incompatible implicit declaration of built-in function 鈖rintf?
main.c:3: warning: return type of 鈓ain?is not 鈏nt?
-bash-3.2$
|
语法是#include 或者#include "xxx.h"
用于标准头文件
""用于自定义的头文件
所以这里应该改成
#include
用于标准头文件
""用于自定义的头文件
所以这里应该改成
#include
|
没找到头文件,看看head.h和main.c是否在同一目录下,还有head.h里面的#include 尖括号你打成圆括号了。