The Surprising Truth Behind C++ Symbol Redefinition
In the article Investigating the Mysterious Field Loss Problem When Using Protobuf in C++, we analyzed how two identical proto files led to linking the wrong pb, ultimately causing some fields to be lost during deserialization. At that time, we also mentioned the process of symbol resolution, where whether it’s dynamic linking or static linking, the symbol definition from the library listed earlier is actually used. I thought I had a deep understanding of this, until I recently encountered another strange “symbol redefinition“ problem.