c - GCC 因 fatal error 终止操作

标签 c linux gcc

我大学的 Linux 服务器运行 gcc 版本 3.4.3 20050227 (Red Hat 3.4.3-22.1),配置如下。

作为练习,我尝试运行并获取错误程序的警告和输出。第一个错误是程序以

开头
#include <stdio> 

而不是

#include <stdio.h>

.

在服务器上,编译器显示第一个错误,然后继续显示其余的错误和警告。然而,在我的本地 VM 上,它只将第一个错误显示为“ fatal error ”,然后终止操作。

我想配置我的本地 GCC,使其行为与远程 GCC 相同。

我正在使用 gcc -Wall -o filename filename.c 在两台机器上编译我的代码。

我的本​​地虚拟机GCC版本:gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

远程 GCC 配置:

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux

本地 GCC 配置:

Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu

最佳答案

前段时间故意启用了丢失 header 的中止(请参阅 BZ 15638 ),因为据信大多数后续错误将由缺少声明引起,因此几乎没有用。没有恢复到旧行为的选项。

关于c - GCC 因 fatal error 终止操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41331386/

相关文章:

c - 这段代码在做什么?

c - 确定一个数字是否可以表示为 n 位整数(二进制补码)

Java进程在运行时打印输出

python - 在 os x 10.6 : unable to execute gcc-4. 0 上安装 rpy2 时出错

performance - 如何测量 GCC 链接选项 -Wl、-z、relro、-z,now 对 ARM 二进制启动的性能影响

c - 如何为数组内的数字范围设置显示值?

c++ - 优化我的 read() 循环 C(两个循环合二为一)

linux - Openwrt:构建错误

linux - 如何将我的 GTK 应用程序放在桌面菜单中?

c++ - Eclipse CDT 控制台输出未显示在带有路径的调试中,也未显示在没有路径的运行中