Question on gcc compiler commands
I had to compile a small little C program using the following;
gcc sine.c -o sine -lm
I needed the "-lm" because the program included the math.h.
In looking this up under compiler commands 开发者_如何学Pythonman shows it a either -llibrary or -l library.
I could not find any information on what other libraries. Apparently -lm is needed for math.h what other library commands might be needed.
Thanks
-lm
means to link the "m" library, which as you said contains math stuff. If you need other libraries for your code, your documentation for those functions will show that.
If it links without errors, you don't need anything anything else. In fact you don't even need to specify -lm, as it and the standard C library are linked automatically.
精彩评论