终于跑起来了,含自定义 include .h 的c语言程序,超开心呀!
header files contain prototypes for functions you define in a .c or .cpp/.cxx file (depending if you're using c or c++).
You want to place #ifndef/#defines around your .h code so that if you include the same .h twice in different parts of your programs, the prototypes are only included once
这本c语言的书不错,学习之,加油!!!
参考:
| foo.h #ifndef FOO_H_ /* Include guard */#define FOO_H_ int foo(int x); /* An example function declaration */ #endif // FOO_H_ foo.c #include "foo.h" /* Include the header (not strictly necessary here) */ int foo(int x) /* Function definition */ { return x + 5; } main.c #include To compile using GCC gcc -o my_app main.c foo.c |