Why do I get "ld: warning: direct access in _main to global weak symbol" in this simple code? [duplicate] Why do I get "ld: warning: direct access in _main to global weak symbol" in this simple code? [duplicate] xcode xcode

Why do I get "ld: warning: direct access in _main to global weak symbol" in this simple code? [duplicate]


See Controlling Symbol Visibility @ developer.apple.com for details.

It looks like your libs (eg. the C++ standard library) and your code have been compiled with different visibility settings, at least, that is what the linker error message is saying.

To fix the warning, you should use the same visibility settings when compiling your code, eg -fvisibility=hidden.