undefined reference to 'webrtc::CreateSessionDescription(std::__ndk1::basic_string, std::__ndk1::allocator > const&, std::__ndk1::basic_string, std::__ndk1::allocator > const&, webrtc::SdpParseError*)'
After updating android ndk revision 11, I get some problems. I could not build my project because of above it.
In Android Developer, I found that 'Changed libc++’s inline namespace to std::__ndk1 to prevent ODR issues with platform libc++.', but I cannot understand.
How can I fix it?
Thanks for helping me.
I think my way is more or less tricky, but it works. I went into /ndk-root-path//sources/cxx-stl/llvm-libc++/libcxx/include, there is a file named '__config'. open it and find out all lines with '_LIBCPP_BEGIN_NAMESPACE_STD', this is where the inline namespace '__ndk1' added. So I just comment out all inline namespaces, like:
352 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {//inline namespace _LIBCPP_NAMESPACE {
353 #define _LIBCPP_END_NAMESPACE_STD } //}
354 #define _VSTD std//::_LIBCPP_NAMESPACE
356 namespace std {
// inline namespace _LIBCPP_NAMESPACE {
// }
}
There should be 4 or 5 pieces of these codes. after comment that, you can rebuild your ndk project, it should works.
I had the error undefined reference to 'std::ndk 1::cout'
I fixed it by changing my gradle file to this:
externalNativeBuild {
cmake {
cppFlags "-DANDROID_STL=c++_shared"
}
}
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