C90 编译器抱怨没有原型函数警告

C90 compiler complaining with a No prototype function warning

我在文件 includes.h

中声明了一个函数 hello()

hello()函数定义在文件source.c

hello() 函数在 main.c 文件中被调用

includes.h 包含以下代码

    /*
     * includes.h
     *
     *  Created on: Jul 26, 2018
     *      Author: salim
     */
    #ifndef T_HEADER_H_
    #define T_HEADER_H_

    #include <stdio.h>
    int hello();


    #endif /* T_HEADER_H_ */

source.c 包含以下代码

    /*
     * source.c
     *
     *  Created on: Jul 26, 2018
     *      Author: salim
     */
    #include <stdio.h>
    #include "includes.h"
    int hello()
    {
       printf("Hello, World!");
       return 0;
    }

main.c 包含以下代码

    /*
     * main.c
     *
     *  Created on: Jul 26, 2018
     *      Author: salim
     */
    #include <stdio.h>
    #include "includes.h"
    int main()
    {
       hello();
       return 0;
    }

编译通过,但编译器生成一条信息消息说 main.c(11) : C0200 (I) No prototype function

我缺少什么来摆脱 info/warning 消息?我知道解决方法可能是转而显示 warning/info 消息,但我不想走那条路。

形式上它是调用点的 "no prototype function"。 int hello() 不是原型。它是 "non-prototype" 类型的函数声明。这是一个K&R风格的声明。

这个函数的原型声明看起来像

int hello(void);

这是否是编译器试图告诉您的(或存在其他问题)是另一个问题。