What actually happens when two shared libraries define the same symbol?
问题 I recently encountered a crash issue when I linked two shared libraries (both made by myself) together. I eventually found it was because of one source file duplicated between the two files. In that source file a global std::vector was defined (in fact a static member of a class), and it ended up with being freed twice -- one by each library. I then wrote some test code to verify my thought. Here in a header I declare a class and a global object of this class: #ifndef SHARED_HEADER_H_ #define