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

I have been trying to link log4cxx into my ObjC/ObjC++/C++ project. It compiles but always fails at the link stage due to undefined symbols. By turning on the Xcode build option "Display Mangled Names" I was able to see why this is the case. The mangled names that the linker is looking for are different from the mangled names in the 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"



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


I created this library was created using the Xcode project provided by Apache.

I see that a similar question (How can I resolve single symbol link error when dynamically linking XCode project to lib4cxx library?) was asked earlier but there was no useful response.

A resolution would be greatly appreciated.


You have mismatched C++ standard library settings. Some of the code is using the new libc++, and some is using GNU's libstdc++. Choose the one you want and change the project settings so they're consistent.

You can use the c++filt command line tool to 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 for example std::basic_string (libstdc++) versus std::__1::basic_string (libc++).

Need Your Help

Change value in column on select JComboBox

java swing jtable jcombobox

I have table with two columns and lot of rows, each column contain JComboBox. I wrap JComboBox into DefaultCellEditor and added to model. How to implement that when I choose in JComboBox ( example ...

DBIx::Class : Resultset order_by based upon existence of a value in the list

sql perl dbix-class

I am using DBIx::Class and I have got a ResultSet. I like to re-order the ResultSet. I like to check a particular column "City" against a fix list of values ("London", "New York" "Tokyo") If cit...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.