Why do you have to link the math library in C?

后端 未结 11 1304
难免孤独
难免孤独 2020-11-22 01:04

If I include or in a C program I don\'t have to link these when compiling but I do have to link to

11条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 02:04

    stdio is part of the standard C library which, by default, gcc will link against.

    The math function implementations are in a separate libm file that is not linked to by default so you have to specify it -lm. By the way, there is no relation between those header files and library files.

提交回复
热议问题