It's very strange behavior in my Clang compiler. I use Xcode (OS X), all is up-to-date. Why am I getting this warning in that simple code? If I remove those two lines the warning hides.
ld: warning: direct access in _main to global weak symbol std::__1::char_traits::eq(char, char) means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
int main( int argc, char* argv[] ) {
std::string file = "test";
size_t pos = file.find( "a" );
return 0;
}
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With