It depends on your compiler and OS. Some compilers/linkers
1) will automatically pick up the relevant libraries
2) may have a standard set and you have to tell them the additional ones
3) will have to be told about every library that is required.
The new C99 standard adds a few more to this list.
With the exception of math.h, all these should be resolved by the 'libc' library which comes with your compiler. Historically in unix (and laterly linux), math.h has been resolved by 'libm' (which you needed to specify). PC based compilers also had a separate 'libm', but they used some heuristics to guess whether you needed it or not. Sometimes they guess wrong and the "Floating point not linked" message would appear at run-time.
As xwb has already said, the rest depends on your compiler. Windows compilers automatically search the core windows API libraries without you having to do anything extra.
The short answer is, if it's anything other than one of the standard C headers, you should at least consider that you'll need to find the appropriate library to resolve any of the symbols you use from those header files.
Most manual pages tell you which header files you need, and which libraries to search.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.