Ha, this sounds more complicated, than it actually is. Here's what I mean:
Suppose I write an application, that uses threads. In this application, I don't use the pthreads
directly, but I use a wrapper, that uses pthreads
. So, in this wrapper's makefile, -lpthread
must be included. And the question - do I need to include -lpthread
in my project, or it's not necessary? Or it depends? If so, on what?
I'm asking this, because I've seen this a lot and I don't think it's necessary.. The same for -std=c++0x
?
Also, I had a problem with the Informix C++ interface, as it relies on lib, called DMI
, which is built on the top of ESQL/C
. When I removed these libraries and use only the real one, I got linker problems(problems with finding the libs). When I added dmi
and esql/c
, everything was fine.
Does this answers my question (with "YES"), or I could've done something wrong, other than this (I'm newbie with makefiles (: )
source: "Makefiles are something of an arcane topic--one joke goes that there is only one makefile in the world and that all other makefiles are merely extensions of it. I assure you, however, that this is not true; I have written my own makefiles from time to time."
This made me think if all included libraries in the makefiles (of my company's projects) are necessary, or this is for "historical reasons"
EDIT: The wrapper around pthread
is linked static, and the Informix
lib was dynamically linked, if this matters.
Also, the OS is RHEL (4 and 5), but I need to know if this depends on the OS and on the way of linking (dynamic or static)
See Question&Answers more detail:
os