Strange warnings from the linker (ld) [duplicate] Strange warnings from the linker (ld) [duplicate] xcode xcode

Strange warnings from the linker (ld) [duplicate]


The solution proposed by xcode with boost : linker(Id) Warning about visibility settings doesn't work: "Symbols hidden by default" has always been "YES".

This has less to do with being set to "YES", and more to do with being set to the same value across all projects. Libs/projects that depend on other libs need to have a likewise setting for "Symbols hidden by default" in order to link properly and free of errors/warnings.

I've run into this before, and a simple change in Xcode for all projects to ensure the settings match typically resolves the problem. Since it sounds like you're compiling on the command line as well, the -fvisibility argument to gcc is what you need to look at.


tl:dr; use -fvisibility=hidden as a gcc and llvm compiler switch in everything you compile, including your dependent libraries, unless you have a reason not to.

A good introduction to the -fvisibility and -fvisibility-inline-hidden compilation flags is available on Apple's web site, as of this writing. The article also goes into some detail on the __attribute__((visibility("hidden"))) and __attribute__((visibility("default"))) declarations.


I got the warning gone in Xcode by putting -fvisibility=hidden -fvisibility-inlines-hidden into OTHER C++ FLAGS.