I’m trying to compile a library that I will be using in several applications, and I’d prefer not to export everything; this would take a ton of time and is unnecessary when only a few key components need to be exported, the rest is internal.
In researching this problem, I found the attribute(visibility) specifier and -fvisibility. While the former seems to work, the latter does not. In particular, my understanding is that I need to do attribute(visibility(“default”)) on any items that should be exported, and then supply the option -fvisibility=hidden to the linker. However, when I do this, I get the error
cc1plus: Invalid option `-fvisibility=hidden’
My understandings are based off what I was reading here: gcc.gnu.org/wiki/Visibility
Is there another way to do this, or a way to resolve this issue?