どのようなヘッダファイルが必要なのかは、 man コマンドによって知ることができます。 例えば三角関数を計算する算術関数 sin/cos を使用しようとするときは、
を実行すれば、math.h を #include すればよいことが分かります (この他、コンパイルの際 cc コマンドの最後に -lm というオプションを 付ける必要があります)。% man sin
TRIG(3M) Silicon Graphics TRIG(3M)
NAME
sin, cos, tan, asin, acos, atan, atan2, fsin, sinf, fcos, cosf, ftan,
tanf, fasin, asinf, facos, acosf, fatan, atanf, fatan2, atan2f -
trigonometric functions and their inverses
SYNOPSIS
#include <math.h>
double sin(double x);
float fsin(float x);
float sinf(float x);
double cos(double x);
float fcos(float x);
float cosf(float x);
double tan(double x);
float ftan(float x);
float tanf(float x);
(以下略)