関数暗黙宣言警告の解決方法_C言語の暗黙宣言ライブラリ関数の警告を解決する方法


関数暗黙宣言警告の解決方法
When compiling a C program you might find that the compiler gives you a warning similar to
Cプログラムをコンパイルすると、コンパイラから以下のような警告が表示される場合があります.
hello.c:6:3: warning: implicitly declaring library function
      'printf' with type 'int (const char *, ...)'
      [-Wimplicit-function-declaration]
  printf("Name length: %u", length);
  ^

or
または
hello.c:5:16: warning: implicitly declaring library function
      'strlen' with type 'unsigned long (const char *)'
      [-Wimplicit-function-declaration]
  int length = strlen(name);
               ^

This problem occurs because you used a function from the standard library without first including the appropriate header file.
この問題は、対応するヘッダファイルを最初に含まない標準ライブラリの関数を使用しているためです.
The compiler will also give you a suggestion, like the following one:
コンパイラは、次のようにアドバイスします.
hello.c:5:16: note: include the header  or
      explicitly provide a declaration for 'strlen'

which points you in the right direction.
正しい方向を示す.
In this case, adding
この場合、
#include 

at the top of the C file will solve the issue.
Cファイルの上部でこの問題が解決されます.
翻訳:https://flaviocopes.com/c-error-implicit-declare-library-function/
関数暗黙宣言警告の解決方法