正确使用头文件? [英] Correctly Using Header Files?
本文介绍了正确使用头文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< stdio.h>
和< stdlib.h>
在每个C文件中...或者我的项目无法编译。这是预期的行为? 解决方案
C模块需要知道如何定义某些东西,或者在哪里可以找到定义。如果定义位于头文件中,则应将其包含在使用它的模块中。这里有一个链接来提供关于头文件的信息。
Lately I have been using header files to split up my program into separate files, (C files containing functions and header files declaring them). Every thing works fine but for some reason, I need to include <stdio.h>
and <stdlib.h>
in EVERY C file... or my project fails to compile. Is this expected behavior?
解决方案
C modules need to know either how something is defined, or where it can find a definition. If the definition is in the header file, then you should include it in the modules that use it. Here is a link to information regarding header files.
这篇关于正确使用头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文