在链接之前检查头文件中的所有函数是否都在c文件中实现

时间:2016-03-26 03:56:34

标签: c compilation

有没有办法检查头文件中的所有函数是否在链接之前实现

示例:

example.h文件

#include<stdio.h>

int function1(void);
int function2(void);
int function3(void);

example.c

#include "example.h"

int function1(void)
{
    printf("Hi. I am function 1\n");
    return 0;
}

我正在寻找一些在编译时返回警告的内容,例如“function2和function3未实现”

有可能吗?

由于

1 个答案:

答案 0 :(得分:1)

您可以尝试查看名为Splint的应用程序,该应用程序在文档的第7.3节中讨论了声明一致性,例如&#39; ...检查函数声明和定义是否一致。&#39; [http://www.splint.org] 我自己并不熟悉这个应用程序,但值得一看,我会说。