Reputation: 113
I have compiled a variety of LLVM Object files.
However, when linking them together, I get this error:
error: Linking globals named '_ZTV4CRpg': symbol multiply defined!
I debugged and found there was a conflict between two objects: rpg.o
and weapons.o
. They both had the _ZTV4CRpg
symbol in them. This translates to a vtable for CRpg. And that would make sense, as they both define CRpg. However, the definitions of CRpg are totally different. Why would this happen and is there a fix?
Here are the two C++ source files: weapons.cpp
, rpg.cpp
I found a bug in LLVM regarding this issue but I cannot apply the latest version as the program I am trying to compile is 7 years old, the patch is 1 year old, and I need to avoid compatibility issues as much as possible.
Using modern compilers, however, it is shown that the symbols are NOT the same:
$ nm build/dlls/CMakeFiles/server.dir/rpg.cpp.o | grep _ZTV4CRpg
U _ZTV4CRpg
$ nm build/dlls/CMakeFiles/server.dir/weapons.cpp.o | grep _ZTV4CRpg
0000000000000000 V _ZTV4CRpg
However on the LLVM build they are both 0000000000000000 V _ZTV4CRpg
Note I used nm
and grep
to scan for conflicting symbols.
Upvotes: 0
Views: 70