Issue
I built a library for Android (WebRTC) and I'm now trying to build a sample file (main.cpp) using a function from that library. The compilation step seems to be ok, but during link I get this:
main.o:main.cpp:function main: error: undefined reference to 'webrtc::CreateSessionDescription(std::string const&, std::string const&, webrtc::SdpParseError*)'
I therefore checked the undefined symbol in my main.o, and I see:
_ZN6webrtc24CreateSessionDescriptionERKSsS1_PNS_13SdpParseErrorE
while in the static library I see:
_ZN6webrtc24CreateSessionDescriptionERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_PNS_13SdpParseErrorE
I'm using the same NDK for both the builds, but I'm not sure what android version of the SDK WebRTC uses (I'm linking to the libs in platforms/android-21/arch-arm/usr/lib).
I also tried to demangle and my main.o contains:
U webrtc::CreateSessionDescription(std::string const&, std::string const&, webrtc::SdpParseError*)
while the library contains:
T webrtc::CreateSessionDescription(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, webrtc::SdpParseError*)
Any idea why this happens and how I can avoid it? Maybe using two different versions of the string header?
Solution
Problem was indeed that the library is built using libc++. Rebuilding on libstdc++ made the link suceed.
Answered By - Luca Carlon
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.