Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Im using header files which accompany two different third-party libraries, and they are “helpfully\ defining common macros such as TRUE, FALSE, Min(), and Max(), but the definitions clash with each other and with definitions Id already established in my own header files. What can I do?

0
Posted

Im using header files which accompany two different third-party libraries, and they are “helpfully\ defining common macros such as TRUE, FALSE, Min(), and Max(), but the definitions clash with each other and with definitions Id already established in my own header files. What can I do?

0

This is indeed an annoying situation. It’s a classic namespace problem; see questions 1.9 and 1.29. Ideally, third-party vendors would be conscientious when defining symbols (both preprocessor #defines and global variable and function names) to assure that namespace collisions were unlikely. The best solution is to get the vendor(s) to fix their header files. As a workaround, you can sometimes undefine or redefine the offending macros between the conflicting #include directives. comp.lang.c FAQ list · Question 10.10b Q: I’m #including the right header file for the library function I’m using, but the linker keeps saying it’s undefined. A: See question 13.25. comp.lang.c FAQ list · Question 10.11 Q: I’m compiling a program, and I seem to be missing one of the header files it requires. Can someone send me a copy? A: There are several situations, depending on what sort of header file it is that’s “missing”. If the missing header file is truly a standard one (that is, one defined by the A

Related Questions