开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜