To compile some legacy code A.c , which has a function prototype
void somefun(...)
gcc 4.1.2 always tell an error
error: ISO C requires a named argument before ...
But I can not modify the code, so what C dialet option should I use to let GCC compile this code?
gcc -c A.c ????
I don’t think any of the C dialects in GCC accept this, but G++ does. What you can do is put the function definition in an
extern "C" {}block and compile the module containing it withg++(assuming it’s also a valid C++ function).You must then declare it in C with
void somefun()(K&R style).This will require linking with
g++as well, though.If C++ linkage is not what you want, then you should change the function to take no arguments and declare it in K&R style.