From 16451850e748c03a596026cc2abab27b84c1fa98 Mon Sep 17 00:00:00 2001 From: Benoit Leforestier Date: Mon, 29 Oct 2018 19:09:42 +0100 Subject: [PATCH] C++: Fix vtable with libstdc++ __cxxabiv1 is an internal namespace used by GNU's libstdc++. When linking with C++ standard library (libstdc++), __cxxabiv1::__class_type_info is already defined inside. If user code contains virtual classes, __cxxabiv1::__class_type_info is defined twice. Signed-off-by: Benoit Leforestier --- subsys/cpp/cpp_vtable.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/cpp/cpp_vtable.cpp b/subsys/cpp/cpp_vtable.cpp index b8e0390fd5..0b31f0ddf7 100644 --- a/subsys/cpp/cpp_vtable.cpp +++ b/subsys/cpp/cpp_vtable.cpp @@ -14,6 +14,7 @@ * @brief basic virtual tables required for classes to build * */ +#if !defined(CONFIG_LIB_CPLUSPLUS) namespace __cxxabiv1 { class __class_type_info { @@ -25,3 +26,4 @@ namespace __cxxabiv1 { void __class_type_info::dummy() { } // causes the vtable to get created here void __si_class_type_info::dummy() { } // causes the vtable to get created here }; +#endif // !defined(CONFIG_LIB_CPLUSPLUS)