GCC -lm -lz -lrt options - what are they about? GCC -lm -lz -lrt options - what are they about? unix unix

GCC -lm -lz -lrt options - what are they about?



-lz links to the zlib, -lm to the math and -lrt to the realtime extensions library.


The switch -lX generally means to load the library libX.so.

libm is the standard math library; it contains sin(), cos(), atanh(), all that good stuff.

libz is Zlib, a compression library which can do gzip, deflate, and a few other formats.

There are a couple of different librt's out there: one is the POSIX realtime extensions; another is a library of general-purpose programming aids.