- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我最近安装了最新版本的 Ubuntu (16) 用于 C++ 开发。当我尝试使用可在此处找到的说明包含“Google Protocol Buffers”时:https://github.com/google/protobuf/blob/master/src/README.md ->
$ sudo apt-get install autoconf automake libtool curl make g++ unzip
$ ./autogen.sh
$ ./configure
$ make
$ make check
$ sudo make install
$ sudo ldconfig # refresh shared library cache.
输入以下命令确实输出了正确的结果,那么GPB的安装就没问题了,不是吗?
> protoc --version
libprotoc 3.2.0
但是当我尝试使用 cmake 构建我的应用程序时 ->
cmake .. && make
client
/home/manuel/Schreibtisch/Repositories/Projekt/maurer/src/main.cpp/home/manuel/Schreibtisch/Repositories/Projekt/maurer/include/TerminalColors.h/home/manuel/Schreibtisch/Repositories/Projekt/maurer/include/Functions.h/home/manuel/Schreibtisch/Repositories/Projekt/maurer/include/URL.h
-- Configuring done
-- Generating done
-- Build files have been written to: /home/manuel/Schreibtisch/Repositories/Projekt/maurer/build
[ 25%] Linking CXX executable client
CMakeFiles/client.dir/src/main.cpp.o: In Funktion `main':
main.cpp:(.text+0x5a8b): Nicht definierter Verweis auf `google::protobuf::internal::VerifyVersion(int, int, char const*)'
main.cpp:(.text+0x5b10): Nicht definierter Verweis auf `google::protobuf::Message::SerializeToOstream(std::ostream*) const'
main.cpp:(.text+0x5bd0): Nicht definierter Verweis auf `google::protobuf::Message::ParseFromIstream(std::istream*)'
main.cpp:(.text+0x5cf0): Nicht definierter Verweis auf `google::protobuf::ShutdownProtobufLibrary()'
CMakeFiles/client.dir/src/main.cpp.o: In Funktion `google::protobuf::internal::GetEmptyStringAlreadyInited[abi:cxx11]()':
main.cpp:(.text._ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedB5cxx11Ev[_ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedB5cxx11Ev]+0x5): Nicht definierter Verweis auf `google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::protobuf_person_2eproto::(anonymous namespace)::protobuf_AssignDescriptors()':
person.pb.cc:(.text+0x6e): Nicht definierter Verweis auf `google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::protobuf_person_2eproto::(anonymous namespace)::protobuf_RegisterTypes(std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const&)':
person.pb.cc:(.text+0x108): Nicht definierter Verweis auf `google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata const*, int)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::protobuf_person_2eproto::TableStruct::InitDefaultsImpl()':
person.pb.cc:(.text+0x15e): Nicht definierter Verweis auf `google::protobuf::internal::VerifyVersion(int, int, char const*)'
person.pb.cc:(.text+0x163): Nicht definierter Verweis auf `google::protobuf::internal::InitProtobufDefaults()'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::protobuf_person_2eproto::AddDescriptorsImpl()':
person.pb.cc:(.text+0x19e): Nicht definierter Verweis auf `google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int)'
person.pb.cc:(.text+0x1ad): Nicht definierter Verweis auf `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const&))'
person.pb.cc:(.text+0x1b7): Nicht definierter Verweis auf `google::protobuf::internal::OnShutdown(void (*)())'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::Person::Person(test::Person const&)':
person.pb.cc:(.text+0x3a6): Nicht definierter Verweis auf `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const*, google::protobuf::internal::ArenaStringPtr)'
person.pb.cc:(.text+0x402): Nicht definierter Verweis auf `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const*, google::protobuf::internal::ArenaStringPtr)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::Person::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)':
person.pb.cc:(.text+0x830): Nicht definierter Verweis auf `google::protobuf::io::CodedInputStream::ReadTagFallback(unsigned int)'
person.pb.cc:(.text+0x90a): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::VerifyUtf8String(char const*, int, google::protobuf::internal::WireFormatLite::Operation, char const*)'
person.pb.cc:(.text+0x9ce): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::VerifyUtf8String(char const*, int, google::protobuf::internal::WireFormatLite::Operation, char const*)'
person.pb.cc:(.text+0xa1d): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::SkipField(google::protobuf::io::CodedInputStream*, unsigned int)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::Person::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const':
person.pb.cc:(.text+0xadb): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::VerifyUtf8String(char const*, int, google::protobuf::internal::WireFormatLite::Operation, char const*)'
person.pb.cc:(.text+0xafe): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const&, google::protobuf::io::CodedOutputStream*)'
person.pb.cc:(.text+0xb34): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::WriteInt32(int, int, google::protobuf::io::CodedOutputStream*)'
person.pb.cc:(.text+0xb90): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::VerifyUtf8String(char const*, int, google::protobuf::internal::WireFormatLite::Operation, char const*)'
person.pb.cc:(.text+0xbb3): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const&, google::protobuf::io::CodedOutputStream*)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::Person::InternalSerializeWithCachedSizesToArray(bool, unsigned char*) const':
person.pb.cc:(.text+0xc2e): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::VerifyUtf8String(char const*, int, google::protobuf::internal::WireFormatLite::Operation, char const*)'
person.pb.cc:(.text+0xceb): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::VerifyUtf8String(char const*, int, google::protobuf::internal::WireFormatLite::Operation, char const*)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::Person::MergeFrom(google::protobuf::Message const&)':
person.pb.cc:(.text+0xe48): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
person.pb.cc:(.text+0xe5e): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::operator<<(char const*)'
person.pb.cc:(.text+0xe76): Nicht definierter Verweis auf `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
person.pb.cc:(.text+0xe8a): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::~LogMessage()'
person.pb.cc:(.text+0xeb7): Nicht definierter Verweis auf `google::protobuf::internal::ReflectionOps::Merge(google::protobuf::Message const&, google::protobuf::Message*)'
person.pb.cc:(.text+0xee5): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::~LogMessage()'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::Person::MergeFrom(test::Person const&)':
person.pb.cc:(.text+0xf71): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
person.pb.cc:(.text+0xf87): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::operator<<(char const*)'
person.pb.cc:(.text+0xfa2): Nicht definierter Verweis auf `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
person.pb.cc:(.text+0xfb6): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::~LogMessage()'
person.pb.cc:(.text+0x10a8): Nicht definierter Verweis auf `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const*, google::protobuf::internal::ArenaStringPtr)'
person.pb.cc:(.text+0x10f2): Nicht definierter Verweis auf `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const*, google::protobuf::internal::ArenaStringPtr)'
person.pb.cc:(.text+0x1145): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::~LogMessage()'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::Closure::Closure()':
person.pb.cc:(.text._ZN6google8protobuf7ClosureC2Ev[_ZN6google8protobuf7ClosureC5Ev]+0x9): Nicht definierter Verweis auf `vtable for google::protobuf::Closure'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::internal::FunctionClosure0::FunctionClosure0(void (*)(), bool)':
person.pb.cc:(.text._ZN6google8protobuf8internal16FunctionClosure0C2EPFvvEb[_ZN6google8protobuf8internal16FunctionClosure0C5EPFvvEb]+0x22): Nicht definierter Verweis auf `vtable for google::protobuf::internal::FunctionClosure0'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::io::CodedOutputStream::IsDefaultSerializationDeterministic()':
person.pb.cc:(.text._ZN6google8protobuf2io17CodedOutputStream35IsDefaultSerializationDeterministicEv[_ZN6google8protobuf2io17CodedOutputStream35IsDefaultSerializationDeterministicEv]+0x7): Nicht definierter Verweis auf `google::protobuf::io::CodedOutputStream::default_serialization_deterministic_'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::io::CodedInputStream::ReadVarint32(unsigned int*)':
person.pb.cc:(.text._ZN6google8protobuf2io16CodedInputStream12ReadVarint32EPj[_ZN6google8protobuf2io16CodedInputStream12ReadVarint32EPj]+0x78): Nicht definierter Verweis auf `google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::io::CodedOutputStream::VarintSize32(unsigned int)':
person.pb.cc:(.text._ZN6google8protobuf2io17CodedOutputStream12VarintSize32Ej[_ZN6google8protobuf2io17CodedOutputStream12VarintSize32Ej]+0x1e): Nicht definierter Verweis auf `google::protobuf::io::CodedOutputStream::VarintSize32Fallback(unsigned int)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::internal::ArenaStringPtr::CreateInstanceNoArena(std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const*)':
person.pb.cc:(.text._ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x4b): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
person.pb.cc:(.text._ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x61): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::operator<<(char const*)'
person.pb.cc:(.text._ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x79): Nicht definierter Verweis auf `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
person.pb.cc:(.text._ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x8d): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::~LogMessage()'
person.pb.cc:(.text._ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr21CreateInstanceNoArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0xdc): Nicht definierter Verweis auf `google::protobuf::internal::LogMessage::~LogMessage()'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::GoogleOnceInit(long*, void (*)())':
person.pb.cc:(.text._ZN6google8protobuf14GoogleOnceInitEPlPFvvE[_ZN6google8protobuf14GoogleOnceInitEPlPFvvE]+0x5e): Nicht definierter Verweis auf `google::protobuf::GoogleOnceInitImpl(long*, google::protobuf::Closure*)'
person.pb.cc:(.text._ZN6google8protobuf14GoogleOnceInitEPlPFvvE[_ZN6google8protobuf14GoogleOnceInitEPlPFvvE]+0x6a): Nicht definierter Verweis auf `google::protobuf::internal::FunctionClosure0::~FunctionClosure0()'
person.pb.cc:(.text._ZN6google8protobuf14GoogleOnceInitEPlPFvvE[_ZN6google8protobuf14GoogleOnceInitEPlPFvvE]+0x7b): Nicht definierter Verweis auf `google::protobuf::internal::FunctionClosure0::~FunctionClosure0()'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::UnknownFieldSet::Clear()':
person.pb.cc:(.text._ZN6google8protobuf15UnknownFieldSet5ClearEv[_ZN6google8protobuf15UnknownFieldSet5ClearEv]+0x20): Nicht definierter Verweis auf `google::protobuf::UnknownFieldSet::ClearFallback()'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::internal::InternalMetadataWithArena::DoMergeFrom(google::protobuf::UnknownFieldSet const&)':
person.pb.cc:(.text._ZN6google8protobuf8internal25InternalMetadataWithArena11DoMergeFromERKNS0_15UnknownFieldSetE[_ZN6google8protobuf8internal25InternalMetadataWithArena11DoMergeFromERKNS0_15UnknownFieldSetE]+0x70): Nicht definierter Verweis auf `google::protobuf::UnknownFieldSet::MergeFrom(google::protobuf::UnknownFieldSet const&)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::internal::InternalMetadataWithArena::default_instance()':
person.pb.cc:(.text._ZN6google8protobuf8internal25InternalMetadataWithArena16default_instanceEv[_ZN6google8protobuf8internal25InternalMetadataWithArena16default_instanceEv]+0x5): Nicht definierter Verweis auf `google::protobuf::UnknownFieldSet::default_instance()'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::MessageLite::MessageLite()':
person.pb.cc:(.text._ZN6google8protobuf11MessageLiteC2Ev[_ZN6google8protobuf11MessageLiteC5Ev]+0x9): Nicht definierter Verweis auf `vtable for google::protobuf::MessageLite'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::MessageLite::~MessageLite()':
person.pb.cc:(.text._ZN6google8protobuf11MessageLiteD2Ev[_ZN6google8protobuf11MessageLiteD5Ev]+0xd): Nicht definierter Verweis auf `vtable for google::protobuf::MessageLite'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::Message::Message()':
person.pb.cc:(.text._ZN6google8protobuf7MessageC2Ev[_ZN6google8protobuf7MessageC5Ev]+0x19): Nicht definierter Verweis auf `vtable for google::protobuf::Message'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::Message::~Message()':
person.pb.cc:(.text._ZN6google8protobuf7MessageD2Ev[_ZN6google8protobuf7MessageD5Ev]+0xd): Nicht definierter Verweis auf `vtable for google::protobuf::Message'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
>*)':
person.pb.cc:(.text._ZN6google8protobuf8internal14WireFormatLite10ReadStringEPNS0_2io16CodedInputStreamEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14WireFormatLite10ReadStringEPNS0_2io16CodedInputStreamEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x1f): Nicht definierter Verweis auf `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
>*)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::internal::WireFormatLite::WriteStringToArray(int, std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const&, unsigned char*)':
person.pb.cc:(.text._ZN6google8protobuf8internal14WireFormatLite18WriteStringToArrayEiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPh[_ZN6google8protobuf8internal14WireFormatLite18WriteStringToArrayEiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPh]+0x39): Nicht definierter Verweis auf `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::__cxx11::basic_string<char, std::char_traits
<char>
, std::allocator
<char>
> const&, unsigned char*)'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `void google::protobuf::Arena::Own
<test::Person>
(test::Person*)':
person.pb.cc:(.text._ZN6google8protobuf5Arena3OwnIN4test6PersonEEEvPT_[_ZN6google8protobuf5Arena3OwnIN4test6PersonEEEvPT_]+0x4d): Nicht definierter Verweis auf `google::protobuf::Arena::AddListNode(void*, void (*)(void*))'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `test::Person const* google::protobuf::internal::DynamicCastToGenerated
<test::Person const>
(google::protobuf::Message const*)':
person.pb.cc:(.text._ZN6google8protobuf8internal22DynamicCastToGeneratedIKN4test6PersonEEEPT_PKNS0_7MessageE[_ZN6google8protobuf8internal22DynamicCastToGeneratedIKN4test6PersonEEEPT_PKNS0_7MessageE]+0x37): Nicht definierter Verweis auf `typeinfo for google::protobuf::Message'
CMakeFiles/client.dir/person.pb.cc.o: In Funktion `google::protobuf::internal::InternalMetadataWithArenaBase<google::protobuf::UnknownFieldSet, google::protobuf::internal::InternalMetadataWithArena>::mutable_unknown_fields_slow()':
person.pb.cc:(.text._ZN6google8protobuf8internal29InternalMetadataWithArenaBaseINS0_15UnknownFieldSetENS1_25InternalMetadataWithArenaEE27mutable_unknown_fields_slowEv[_ZN6google8protobuf8internal29InternalMetadataWithArenaBaseINS0_15UnknownFieldSetENS1_25InternalMetadataWithArenaEE27mutable_unknown_fields_slowEv]+0xbd): Nicht definierter Verweis auf `google::protobuf::Arena::AllocateAligned(std::type_info const*, unsigned long)'
person.pb.cc:(.text._ZN6google8protobuf8internal29InternalMetadataWithArenaBaseINS0_15UnknownFieldSetENS1_25InternalMetadataWithArenaEE27mutable_unknown_fields_slowEv[_ZN6google8protobuf8internal29InternalMetadataWithArenaBaseINS0_15UnknownFieldSetENS1_25InternalMetadataWithArenaEE27mutable_unknown_fields_slowEv]+0x118): Nicht definierter Verweis auf `google::protobuf::Arena::AddListNode(void*, void (*)(void*))'
CMakeFiles/client.dir/person.pb.cc.o:(.rodata._ZTVN4test6PersonE[_ZTVN4test6PersonE]+0x20): Nicht definierter Verweis auf `google::protobuf::Message::GetTypeName[abi:cxx11]() const'
CMakeFiles/client.dir/person.pb.cc.o:(.rodata._ZTVN4test6PersonE[_ZTVN4test6PersonE]+0x58): Nicht definierter Verweis auf `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
CMakeFiles/client.dir/person.pb.cc.o:(.rodata._ZTVN4test6PersonE[_ZTVN4test6PersonE]+0x60): Nicht definierter Verweis auf `google::protobuf::Message::CheckTypeAndMergeFrom(google::protobuf::MessageLite const&)'
CMakeFiles/client.dir/person.pb.cc.o:(.rodata._ZTVN4test6PersonE[_ZTVN4test6PersonE]+0xa8): Nicht definierter Verweis auf `google::protobuf::Message::DiscardUnknownFields()'
CMakeFiles/client.dir/person.pb.cc.o:(.rodata._ZTVN4test6PersonE[_ZTVN4test6PersonE]+0xb0): Nicht definierter Verweis auf `google::protobuf::Message::SpaceUsed() const'
CMakeFiles/client.dir/person.pb.cc.o:(.rodata._ZTIN4test6PersonE[_ZTIN4test6PersonE]+0x10): Nicht definierter Verweis auf `typeinfo for google::protobuf::Message'
collect2: error: ld returned 1 exit status
CMakeFiles/client.dir/build.make:129: die Regel für Ziel „client“ scheiterte
make[2]: *** [client] Fehler 1
CMakeFiles/Makefile2:67: die Regel für Ziel „CMakeFiles/client.dir/all“ scheiterte
make[1]: *** [CMakeFiles/client.dir/all] Fehler 2
Makefile:83: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2
>
我已经尝试完全重新构建应用程序(删除构建文件夹)并重新安装了不同版本的 GoogleProtocolBuffers。这是我的 CMakeLists.txt 文件 ->
cmake_minimum_required(VERSION 3.0)
project(18_HTTPClient) # change xxx to your project name
set(CMAKE_CXX_STANDARD 14) # change if necessary
add_definitions(-DASIO_STANDALONE)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
#add_definitions(-Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion)
# add_definitions(-Wl,--no-as-needed) # needed for building on buggy configurations
else()
add_definitions(-DASIO_HAS_STD_ADDRESSOF)
add_definitions(-DASIO_HAS_STD_ARRAY)
add_definitions(-DASIO_HAS_CSTDINT)
add_definitions(-DASIO_HAS_STD_SHARED_PTR)
add_definitions(-DASIO_HAS_STD_TYPE_TRAITS)
add_definitions(-DASIO_HAS_STD_ATOMIC)
add_definitions(-D_WIN32_WINNT=0x0501)
add_definitions(/Wall /EHsc)
endif()
find_package(Threads)
include_directories(include)
include_directories(include/STLPlus)
# important: Don't forget to set the environment variable accordingly (if needed)!
include_directories($ENV{ASIO_INCLUDE_PATH})
include_directories($ENV{SPDLOG_INCLUDE_PATH})
include_directories($ENV{FMT_PATH}) # should refer to the root directory of fmt
include_directories($ENV{JSON_INCLUDE_PATH}) # should refer to the directory 'src' of json
set(FMT_LIB_PATH $ENV{FMT_PATH}/fmt/fmt/libfmt.a)
#set(FMT_LIB_PATH $ENV{FMT_PATH}/build/fmt/libfmt.a)
# only needed for protobuf
find_package(Protobuf REQUIRED)
include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
file(GLOB protos protos/*.proto)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${protos})
macro(create_targets)
if(${ARGC} GREATER 1)
foreach(curr_target ${ARGV})
message(${curr_target})
# includes are only for usage with QtCreator!
file(GLOB sources src/${curr_target}/*.cpp src/*.cpp include/${curr_target}/*.h include/*.h)
add_executable(${curr_target} ${sources} ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(${curr_target} ${CMAKE_THREAD_LIBS_INIT} ${FMT_LIB_PATH} ${Protobuf_LIBRARIES})
endforeach(curr_target)
else()
message(${ARGV0})
IF(EXISTS "${CMAKE_SOURCE_DIR}/src/${ARGV0}" AND IS_DIRECTORY "${CMAKE_SOURCE_DIR}/src/${ARGV0}")
file(GLOB sources src/${ARGV0}/*.cpp src/*.cpp include/${ARGV0}/*.h include/*.h)
else()
file(GLOB sources src/*.cpp include/*.h)
endif()
message(${sources})
add_executable(${ARGV0} ${sources} ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(${ARGV0} ${CMAKE_THREAD_LIBS_INIT} ${FMT_LIB_PATH} ${Protobuf_LIBRARIES})
endif()
endmacro(create_targets)
# replace xxx with list of executables
# like: create_targets(exe) or create_targets(exe1 exe2 exe3)
# if just one target is given -> source files are in 'src'
# else -> source files specific for each target are in respective
# subdirectories of 'src' like in 'src/exe1', 'src/exe2', and 'src/exe3'
# common source files are in 'src'
create_targets(client)
关于我可以做什么的任何建议?提前致谢。如果您需要任何进一步的详细信息或文件内容,我会尽快上传。
最佳答案
我怀疑您使用的是 3.6 之前的 cmake 版本。如果是这样,升级或使用 PROTOBUF_
而不是 Protobuf_
可能会解决您的问题;另见 this SO answer了解详情。
关于c++ - 谷歌 Protobuf 3 : Undefined Reference Errors when building with CMAKE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42186095/
#include using namespace std; class C{ private: int value; public: C(){ value = 0;
这个问题已经有答案了: What is the difference between char a[] = ?string?; and char *p = ?string?;? (8 个回答) 已关闭
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 此帖子已于 8 个月
除了调试之外,是否有任何针对 c、c++ 或 c# 的测试工具,其工作原理类似于将独立函数复制粘贴到某个文本框,然后在其他文本框中输入参数? 最佳答案 也许您会考虑单元测试。我推荐你谷歌测试和谷歌模拟
我想在第二台显示器中移动一个窗口 (HWND)。问题是我尝试了很多方法,例如将分辨率加倍或输入负值,但它永远无法将窗口放在我的第二台显示器上。 关于如何在 C/C++/c# 中执行此操作的任何线索 最
我正在寻找 C/C++/C## 中不同类型 DES 的现有实现。我的运行平台是Windows XP/Vista/7。 我正在尝试编写一个 C# 程序,它将使用 DES 算法进行加密和解密。我需要一些实
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
有没有办法强制将另一个 窗口置于顶部? 不是应用程序的窗口,而是另一个已经在系统上运行的窗口。 (Windows, C/C++/C#) 最佳答案 SetWindowPos(that_window_ha
假设您可以在 C/C++ 或 Csharp 之间做出选择,并且您打算在 Windows 和 Linux 服务器上运行同一服务器的多个实例,那么构建套接字服务器应用程序的最明智选择是什么? 最佳答案 如
你们能告诉我它们之间的区别吗? 顺便问一下,有什么叫C++库或C库的吗? 最佳答案 C++ 标准库 和 C 标准库 是 C++ 和 C 标准定义的库,提供给 C++ 和 C 程序使用。那是那些词的共同
下面的测试代码,我将输出信息放在注释中。我使用的是 gcc 4.8.5 和 Centos 7.2。 #include #include class C { public:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我的客户将使用名为 annoucement 的结构/类与客户通信。我想我会用 C++ 编写服务器。会有很多不同的类继承annoucement。我的问题是通过网络将这些类发送给客户端 我想也许我应该使用
我在 C# 中有以下函数: public Matrix ConcatDescriptors(IList> descriptors) { int cols = descriptors[0].Co
我有一个项目要编写一个函数来对某些数据执行某些操作。我可以用 C/C++ 编写代码,但我不想与雇主共享该函数的代码。相反,我只想让他有权在他自己的代码中调用该函数。是否可以?我想到了这两种方法 - 在
我使用的是编写糟糕的第 3 方 (C/C++) Api。我从托管代码(C++/CLI)中使用它。有时会出现“访问冲突错误”。这使整个应用程序崩溃。我知道我无法处理这些错误[如果指针访问非法内存位置等,
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一些 C 代码,将使用 P/Invoke 从 C# 调用。我正在尝试为这个 C 函数定义一个 C# 等效项。 SomeData* DoSomething(); struct SomeData {
这个问题已经有答案了: Why are these constructs using pre and post-increment undefined behavior? (14 个回答) 已关闭 6
我是一名优秀的程序员,十分优秀!