I’m compiling a C program which includes sybdb.h and I get the error “two or more data types in declaration specifiers” at the typedef line below (and sybdb.h is a standard file, not one of mine).
#if !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(DOS32X)
typedef int BOOL;
#endif
It appears that there is some kind of a conflict with another library I am including, but have no idea what the error means or how to fix it. Help?
Most likely another header (or your implementation of C itself) has done something like:
so that your compiler is seeing:
By way of experiment, when I compile the code:
it works fine but, when I change that first line to
#define BOOL unsigned char, I get the exact same message you see:To confirm this, you can compile only the pre-processor phase to see what that code really looks like to the compiler phase.
This depends on the compiler, of course,
gcc -Eis the option you would use forgcc.Fixing it is another matter. You may well have to change one of the alias types to
BOOL1or something incredibly ugly like that. That’s likely to be a larger change since I imagine it would be used quite a bit.You may be able to get away with simply ensuring both subsystems use the same definition of
BOOLbut it will still take quite a bit of analysis to confirm that this won’t have adverse side effects.To test (and even possibly implement) this fix, you can change the
#ifstatement to something like:and then compile your code with
gcc -DSKIP_BOOL_DEF(or equivalent) to ensure thetypedefisn’t done. It would then use your (hopefully compatible) system definition.