Undefined reference to google::protobuf::internal::empty_string_[abi:cxx11]
I suspect this is a C++ ABI issue. The ABI for std::string
has changed in GCC 5 (related to C++11 requirements, but it applies even if you aren't using C++11). See:
https://gcc.gnu.org/gcc-5/changes.html#libstdcxx
If libprotobuf was built with GCC 4.x or prior, but your app is built with GCC 5, then you will see problems, because libprotobuf uses std::string
in its interface. You have two options:
- Rebuild libprotobuf with GCC 5 (but now any apps built with GCC 4 won't work with the new version of libprotobuf).
- Build you app with
-D_GLIBCXX_USE_CXX11_ABI=0
as described at the above link. This will force GCC to use the old ABI version.
Can't build test C++ app with Google's protobuf
Problem was in the linker search path. Linker tried to use libprotobuf from OS distributon (version 8.0.0) instead of lib built by me (version 9.0.1).
can't build gem5 because of undefined reference warnings
Before building gem5, ensure you're using compatible dependencies, as listed in the official documentation: https://www.gem5.org/documentation/general_docs/building
Your gcc version is unsupported (too old). Your protobuf version is supported.
Try upgrading your gcc version to at least GCC 7. This is not directly available from Ubuntu 16.04, but you will find different alternative ways of installing it in the web, including building it from source. Otherwise, use a more recent Ubuntu version.
undefined reference to 'ClassName::memberField[abi:cxx11]'
In Code-Listing-2 Node.cpp:
#include "Node.hpp"
list<Node *> nodes;
Node::Node() {
// ...
Should be:
#include "Node.hpp"
list<Node *> Node::nodes;
Node::Node() {
// ...
Without Node::
, you are declaring a global variable nodes
unrelated to the static member Node::nodes
, thus the undefined reference since a static member variable needs a proper definition.
Cannot resolve symbol in libprotobuf in openwrt
This looks like it's probably caused by using a different compiler / C++ ABI to compile your application vs. libprotobuf.so. See this previous question for more:
Undefined reference to google::protobuf::internal::empty_string_[abi:cxx11]
Related Topics
Making a C++ Class a Monitor (In the Concurrent Sense)
Creating Library with Backward Compatible Abi That Uses Boost
Error::Make_Unique Is Not a Member of 'Std'
Calling a Constructor to Re-Initialize Object
Qt - Remove All Widgets from Layout
C++11 Variable Number of Arguments, Same Specific Type
Performance Wise, How Fast Are Bitwise Operators VS. Normal Modulus
Show Two Digits After Decimal Point in C++
What Is a "Regular Type" in the Context of Move Semantics
Conversion from Boost::Shared_Ptr to Std::Shared_Ptr
C++ Template Class; Function with Arbitrary Container Type, How to Define It
C++ Metafunction to Determine Whether a Type Is Callable
Switch "Transfer of Control Bypasses Initialization Of:" When Calling a Function
Template Parameter Packs Access Nth Type and Nth Element
List of C++ Name Resolution (And Overloading) Rules