objective c - Linker error when trying to link log4cxx into an Xcode ObjC/C++ program -


i have been trying link log4cxx objc/objc++/c++ project. compiles fails @ link stage due undefined symbols. turning on xcode build option "display mangled names" able see why case. mangled names linker looking different mangled names in log4cxx.dylib file.

for example

"log4cxx::logger::forcedlog(log4cxx::helpers::objectptrt<log4cxx::level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::locationinfo const&) const" 

becomes

"__znk7log4cxx6logger9forcedlogerkns_7helpers10objectptrtins_5leveleeerknst3__112basic_stringicns7_11char_traitsiceens7_9allocatoriceeeerkns_3spi12locationinfoe" 

from linker's point of view. closest symbol nm reports in log4cxx.dylib is

__znk7log4cxx6logger9forcedlogerkns_7helpers10objectptrtins_5leveleeerksbiwst11char_traitsiwesaiweerkns_3spi12locationinfoe 

i created library created using xcode project provided apache.

i see similar question (how can resolve single symbol link error when dynamically linking xcode project lib4cxx library?) asked earlier there no useful response.

a resolution appreciated.

you have mismatched c++ standard library settings. of code using new libc++, , using gnu's libstdc++. choose 1 want , change project settings they're consistent.

you can use c++filt command line tool un-mangle c++ symbol names:

% c++filt __znk7log4cxx6logger9forcedlogerkns_7helpers10objectptrtins_5leveleeerknst3__112basic_stringicns7_11char_traitsiceens7_9allocatoriceeeerkns_3spi12locationinfoe log4cxx::logger::forcedlog(log4cxx::helpers::objectptrt<log4cxx::level> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, log4cxx::spi::locationinfo const&) const % c++filt __znk7log4cxx6logger9forcedlogerkns_7helpers10objectptrtins_5leveleeerksbiwst11char_traitsiwesaiweerkns_3spi12locationinfoe log4cxx::logger::forcedlog(log4cxx::helpers::objectptrt<log4cxx::level> const&, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, log4cxx::spi::locationinfo const&) const 

note example std::basic_string (libstdc++) versus std::__1::basic_string (libc++).


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -