0

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.

Samuel
  • 803
  • 8
  • 17

1 Answers1

3

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.

yugr
  • 19,769
  • 3
  • 51
  • 96