开发者

Question on gcc compiler commands

开发者 https://www.devze.com 2022-12-28 07:01 出处:网络
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.

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

精彩评论

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