Reputation: 851
If I want to create a static library for everyone to use, is it necessary compile it with -fPIC or -fPIE?
It is working for me without -fPIC or -fPIE.
Upvotes: 0
Views: 1853
Reputation: 21878
You want your library to be linkable into shared libraries, position-dependent and position-independent executables. The only flag which works in all of these cases is -fPIC
so that's the one you should use.
Upvotes: 3