Linking Libraries with Duplicate Class Names using GCC

前端 未结 4 824
野的像风
野的像风 2020-12-17 18:43

Is there a way for GCC to produce a warning while linking libraries that contain classes with the same name? For example

Port.h

class Port {         


        
4条回答
  •  醉酒成梦
    2020-12-17 19:19

    No there isn't. The reason for this is that a class name is not a symbol as far as the linker is concerned. The C++ compiler will have used the class name to produce mangled function names, but the class name itself is gone by the time the linker gets involved.

提交回复
热议问题