How to handle a class name conflict when porting old code?

后端 未结 5 1604
情话喂你
情话喂你 2021-01-05 23:04

I\'m trying to port an old library (that doesn\'t use namespaces as far as I can tell) to modern compilers. One of my targets can\'t tell the difference between System::TObj

5条回答
  •  再見小時候
    2021-01-05 23:12

    I have used the following in the past while encapsulating a third party header file containing classes colliding with the code:

    #ifdef Symbol
    #undef Symbol
    #define Symbol ThirdPartySymbol
    #endif
    #include 
    #undef Symbol
    

    This way, "Symbol" in the header was prefixed by ThirdParty and this was not colliding with my code.

提交回复
热议问题