Samuel
Samuel

Reputation: 851

Build static Library with -fPIC or -fPIE

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

Answers (1)

yugr
yugr

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

Related Questions