function declared static but never defined

前端 未结 2 1321
忘掉有多难
忘掉有多难 2021-02-01 14:19

I have a header file suppose abc.h, where i have function declaration as:

static int function1();

I have included this header file in abc.c and

2条回答
  •  有刺的猬
    2021-02-01 14:38

    A static function can be declared in a header file, but this would cause each source file that included the header file to have its own private copy of the function, which is probably not what was intended.

    Are u sure u haven't included the abc.h file in any other .c files?

    Because declaring a function as static, requires the function to be defined in all .c file(s) in which it is included.

提交回复
热议问题