忽略与 gcc 不兼容的指针类型 (char**→void**)
我正在编译一些遗留的 C 代码,目的是将其迁移到 Java。
我不想修复 C 代码,我只想运行它,以便比较数值结果。
我收到此 gcc 4.6.1 编译错误:expected void** but argument is of type char**
这段代码写于 20 年前,并不关心指针类型,这并不奇怪。
问题:如何告诉 gcc 忽略这些错误并继续编译?-fpermissive
不起作用。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您尝试使用哪个版本的 gcc 进行编译? gcc 3 支持
-traditional
标志,该标志将告诉它表现 像 K&RC 编译器,但 gcc 4 中不包含此选项。您可能需要以某种方式运行 gcc 3,例如安装将其包含在 VM 中的操作系统。我读到 RHEL 4 使用 gcc 3,您可以尝试旧的 FreeBSD 版本,或者它可能作为较新操作系统上的软件包提供。
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.
默认情况下,gcc 仅发出警告。您的编译标志中的某处必须有
-Werror
或-pedantic-errors
标志,从而将此警告转换为错误。By default, gcc only emits a warning. You must be having a
-Werror
or-pedantic-errors
flag somewhere in your compilation flags that turns this warning into an error.