gcc 常见编译警告与错误
gcc 常见的编译警告与错误(按字母顺序排列)
C语言初学者遇到的最大问题往往是看不懂编译错误,进而不知如何修改程序。有鉴于此,本附录罗列了用gcc编译程序时经常出现的编译警告与错误。需要提醒读者的是,出现警告(warning)并不影响目标程序的生成,但出现错误(error)则无法生成目标程序。
为便于读者查阅,下面列出了经常遇到的警告与错误,给出了中英文对照(英文按字典顺序排列),并对部分错误与警告做了必要的解释。
#%s expects \FILENAME\ or …
#%s 需要 \FILENAME\ 或…
#%s is a deprecated GCC extension
#%s 是一个已过时的 GCC 扩展
#%s is a GCC extension
#%s 是一个 GCC 扩展
#~ error:
#~ 错误:
#~ In file included from %s:%u
#~ 在包含自 %s:%u 的文件中
#~ internal error:
#~ 内部错误:
#~ no newline at end of file
#~ 文件未以空白行结束
#~ warning:
#~ 警告:
#elif after #else
#elif 出现在 #else 后
#elif without #if
#elif 没有匹配的 #if
#else after #else
#else 出现在 #else 后
#else without #if
#else 没有匹配的 #if
#endif without #if
#endif 没有匹配的 #if
#include nested too deeply
#include 嵌套过深
#include_next in primary source file
#include_next 出现在主源文件中
#pragma %s %s is already registered
#pragma %s %s 已经被注册
#pragma %s is already registered
#pragma %s 已经被注册
#pragma once in main file
#pragma once 出现在主文件中
#pragma system_header ignored outside include file
#pragma system_heade 在包含文件外被忽略
%.*s is not a valid universal character
%.*s 不是一个有效的 Unicode 字符
%s in preprocessing directive
预处理指示中出现 %s
%s is a block device
%s 是一个块设备
%s is shorter than expected
%s 短于预期
%s is too large
%s 过大
%s with no expression
%s 后没有表达式
%s: not used because `%.*s’ defined as `%s’ not `%.*s’
%s:未使用因为‘%.*s’被定义为‘%s’而非‘%*.s’
%s: not used because `%.*s’ is poisoned
%s:未使用因为‘%.*s’已被投毒
%s: not used because `%.*s’ not defined
%s:未使用因为‘%.*s’未定义
%s: not used because `%s’ is defined
%s:未使用因为‘%s’已定义
%s: not used because `__COUNTER__’ is invalid
%s:未使用因为‘__COUNTER__’无效
(\%s\ is an alternative token for \%s\ in C++)
(在 C++ 中“%s”会是“%s”的替代标识符)
(this will be reported only once per input file)
(此警告为每个输入文件只报告一次)
\%s\ after # is not a positive integer
# 后的“%s”不是一个正整数
\%s\ after #line is not a positive integer
#line 后的“%s”不是一个正整数
\%s\ cannot be used as a macro name as it is an operator in C++
“%s