In my code base I find that two modules have structures with the same name. It is giving a name conflict error. Is there a way to resolve it without changing the code?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is a terrible hack, but it would be possible to use a macro to redefine the name of the struct, like so
You’d probably want to rename the struct for both headers to give errors when someone inevitably uses the wrong struct, perhaps in a wrapper header like
Remember to undef the macro so you don’t get random replacements throughout your code.