【发布时间】:2015-05-22 02:23:03
【问题描述】:
我有一个主 .c 文件,其中包含 4 个 .h 文件和包含在 main 函数中的 .c 文件。像这样:
#include <stdio.h>
#include "file1.h"
#include "file2.h"
#include "file3.h"
#include "file4.h"
int main(){...}
.h 文件包含所有对应的 .c 文件的所有声明。一些 .c 文件确实使用了其他 .c 文件中的函数,例如“file4.c”使用“file2.h”中声明的一些函数,“file1.c”使用“file3.h”中声明的函数。我尝试在每个 .c 文件中声明与 main 中相同的包含,并尝试重新排序包含文件,但我仍然收到有关函数的隐式声明和不兼容的隐式声明的警告消息。
我想知道您将如何在大型项目中使用#include 来消除警告消息。我使用 gcc 作为编译器。
【问题讨论】:
-
也许你应该发布一个示例警告。
标签: c include include-path gcc-warning