I’m not very experienced in C++, and when I have to work with another library and I get link errors, I’m completely in the dark on what the compiler is trying to tell me (other than it can’t find something reference somewhere).
Are there any good links that describe, in detail, the meaning of the symbols and characters in a link error message? Or how to trouble shoot such errors?
For example, this is a link error I received recently:
testproj error LNK2019: unresolved external symbol ‘public: __thiscall google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(class google::protobuf::Descriptor const *,class google::protobuf::Message const *,int const * const,int,int,int,class google::protobuf::DescriptorPool const *,int)’ (??0GeneratedMessageReflection@internal@protobuf@google@@QAE@PBVDescriptor@23@PBVMessage@23@QBHHHHPBVDescriptorPool@23@H@Z) referenced in function ‘void __cdecl testproj::protobuf_BuildDesc_def_2eproto_AssignGlobalDescriptors(class google::protobuf::FileDescriptor const *)’ (?protobuf_BuildDesc_def_2eproto_AssignGlobalDescriptors@testproj@@YAXPBVFileDescriptor@protobuf@google@@@Z)
The symbols are the ‘mangled’ versions of the function names. Basically because of c++ overloading (2 functions with different signatures can have the same name). The signature information is encoded into the name.
The message you pasted has both the encoded and plain text versions.
are the same thing, just the later is mangled.
Notice that the mangled version starts with:
which corresponds nicely with:
Because the first few lines give you the relevant information, you can pretty much ignore the mangled versions. The plain text versions of the signatures are sufficient to fix the linker error.