Search code examples
cgcclegacy

Ignore incompatible pointer types with gcc (char**→void**)


I am compiling some legacy C code with the purpose of migrating it to Java.
I don't want to fix the C code, I just want to run it, in order to compare numerical results.

I get this gcc 4.6.1 compilation error: expected void** but argument is of type char**
Written 20 years ago, this code did not care about pointer types, no big surprise.

QUESTION: How can I tell gcc to ignore these errors and compile anyway?
-fpermissive does not work.


Solution

  • What version of gcc are you trying to compile with? gcc 3 supported a -traditional flag which would tell it to behave like a K&R C compiler, but this option isn't included in gcc 4.

    You probably need to run gcc 3 somehow, like installing an OS that included it in a VM. I've read that RHEL 4 used gcc 3, you could try old FreeBSD versions, or it might be available as a package on newer OSes.