問題描述
1.編譯protobuf的時候會出現鏈接錯誤:
undefined reference to `google::protobuf::Message::SpaceUsedLong() const'
2.編譯的時候會出現
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): CHECK failed: (scc->visit_status.load(std::memory_order_relaxed)) == (SCCInfoBase::kRunning):
Aborted (core dumped)
解決方法
1.鏈接到protobuf靜態庫即可:
g++ -lprotobuf
2.初次編譯可能會出現這個問題,需要添加
g++ -lpthread
后面編譯就不會出現這個問題,不加pthread也可以編譯通過。
環境
centos 7
libprotoc 3.14.0
