Why is linking with -lpthread necessary on Linux?
#1005
-
|
I've built a small program which uses miniaudio and the example libvorbis decoder, and it builds and runs just fine without linking to that library on Linux. I only used |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Those options just specify the libraries to be searched to satisfy references in your code. Only referenced code is included in the resulting executable. If you did not get any linkage errors, it happens that you have no dependencies there in your code and code that is used from miniaudio. I presume the recommendation is precautionary, avoiding the problem of linkage errors that might occur on omission of that library. Technically, it costs nothing. That |
Beta Was this translation helpful? Give feedback.
-
|
It's because not all compilers link to it by default, and I support a lot of compilers. It's just easier from a project maintenance point of view to mention it so that beginners are less likely to post bug reports or questions if they stumble on linking errors. |
Beta Was this translation helpful? Give feedback.
It's because not all compilers link to it by default, and I support a lot of compilers. It's just easier from a project maintenance point of view to mention it so that beginners are less likely to post bug reports or questions if they stumble on linking errors.