While analyzing some library code supplied by another company we have come across strange construct (probably an error). In the header file a function was declared as:
int funct(type1 var1, type2 var2, void* usr_arg);
(sorry for general naming. NDA) But in the source file function of the same name was defined as:
int funct(type1 var1, type2 var2, long usr_arg)
{
// code goes here;
}
And the most curious thing was, that while compiling with the makefile supplied, everything works fine. When we tried to configure eclipse project however, it refused compilation and pointed us at exactly two function headers stated above.
Compiler used in our case is gcc under ubuntu, however the library is supposed to work under windows as well. How can we make gcc accept this monstrosity?
It’s not very strange, the Makefile probably passes some flag to gcc to ignore that, or just issue a warning, while the eclipse project doesn’t, or it could be that the eclipse project compiler flags are more strict. Anyway, I suggest you change the function declaration to match its definition (or the other way around depending on what the function actually expects) and the error will go away.