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”不能被用作宏名,因为它是 C++ 中的一个操作符
\\%s\\ is not a valid filename
“%s”不是一个有效的文件名
\\%s\\ is not defined
“%s”未定义
\\%s\\ may not appear in macro parameter list
“%s不能出现在宏参数列表中
\\%s\\ re-asserted
重断言“%s”
\\%s\\ redefined
“%s重定义
\\/*\\ within comment
“/*出现在注释中
\\\\x used with no following hex digits
\\\\x 后没有 16 进制数字
\\defined\\ cannot be used as a macro name
“defined不能被用作宏名
__COUNTER__ expanded inside directive with -fdirectives-only
带 -fdirectives-only 时 __COUNTER__ 在指示中扩展
__VA_ARGS__ can only appear in the expansion of a C99 variadic macro
__VA_ARGS__ 只能出现在 C99 可变参数宏的展开中
_Pragma takes a parenthesized string literal
_Pragma 需要一个括起的字符串字面常量
‘%.*s’ is not in NFC
‘%.*s’不在 NFC 中
‘%.*s’ is not in NFKC
‘%.*s’不在 NFKC 中
‘##’ cannot appear at either end of a macro expansion
‘##’不能出现在宏展开的两端
‘#’ is not followed by a macro parameter
‘#’后没有宏参数
‘$’ in identifier or number
‘$’出现在标识符或数字中
‘:’ without preceding ‘?’
‘:’前没有‘?’
‘?’ without following ‘:’
‘?’后没有‘:’
'return' with a value, in function returning void
在void返回类型的函数中,return返回值。
\"protocol_type\" redefined
protocol_type重定义
anonymous variadic macros were introduced in C99
匿名可变参数宏在 C99 中被引入
assertion without predicate
断言后没有谓词
assertions are a deprecated extension
断言是一个已过时的 GCC 扩展
assertions are a GCC extension
断言是一个 GCC 扩展
assignment discards qualifiers from pointer target type
赋值时,取消了右值的限定。
assignment from incompatible pointer type
不兼容的指针间赋值
attempt to use poisoned \\%s\\
试图使用有毒的“%s”
backslash and newline separated by space
反斜杠和换行为空格所分隔
backslash-newline at end of file
反斜杠续行出现在文件末尾
binary constants are a GCC extension
二进制常量是一个 GCC 扩展
C++ style comments are not allowed in ISO C90
C++ 风格的注释在 ISO C90 中不被允许
cannot find source file %s
找不到源文件 %s
Character %x might not be NFKC
字符 %x 可能不是 NFKC
character 0x%lx is not in the basic source character set\\n
字符 0x%lx 不在基本源字符集中\\n
character 0x%lx is not unibyte in execution character set
字符 0x%lx 在执行字符集中不是单字节的
character constant too long for its type
字符常量大小超出其类型
comma operator in operand of #if
#if 操作数中出现逗号
comparison between pointer and integer
integer与pointer比较
comparison is always false due to limited range of data type
由于数据类型范围的,比较结果一直为假
comparison is always true due to limited range of data type
由于数据类型范围的,比较结果一直为真。
conversion from %s to %s not supported by iconv
iconv 不支持从 %s 到 %s 的转换
converting escape sequence to execution character set
将转义序列转换到执行字符集
converting to execution character set
转换到可执行文件的字符集
converting UCN to execution character set
将 UCN 转换到执行字符集
converting UCN to source character set
将 UCN 转换到源字符集
could not determine date and time
无法决定日期与时间
could not determine file timestamp
无法决定文件的时间戳
CPP arithmetic must be at least as precise as a target int
CPP 算术必须至少具有目标 int 的精度
CPP half-integer narrower than CPP character
CPP 半整数短于 CPP 字符
CPP on this host cannot handle wide character constants over %lu bits, but the target requires %lu bits
在此宿主机上,CPP 不能处理长于 %lu 位的宽字符常量,但目标需要 %lu 位
cppchar_t must be an unsigned type
cppchar_t 必须是无符号型
current file is older than %s
当前文件早于 %s
decimal float constants are a GCC extension
十进制浮点常量是一个 GCC 扩展
detected recursion whilst expanding macro \\%s\\
展开宏%s时检测到递归
division by zero in #if
#if 中用零做除数
duplicate macro parameter \\%s\\
重复的宏参数“%s”
embedding a directive within macro arguments is not portable
将一个指示嵌入宏参数中是不可移植的
empty character constant
空的字符常量
empty filename in #%s
#%s 中文件名为空
expected expression before 'else'
else之前无表达式
exponent has no digits
指数部分没有数字
extra tokens at end of #%s directive
#%s 指示的末尾有多余的标识符
failure to convert %s to %s
无法从 %s 转换到 %s
fixed-point constants are a GCC extension
定点常量是一个 GCC 扩展
floating constant in preprocessor expression
浮点常量出现在预处理表达式中
function-like macro \\%s\\ must be used with arguments in traditional C
类似函数的宏“%s”在传统 C 中必须与参数一起使用
hex escape sequence out of range
16 进制转义序列越界
hexadecimal floating constants require an exponent
16 进制浮点常量需要指数部分
identifier \\%s\\ is a special operator name in C++
标识符“%s”是 C++ 中的一个特殊操作符
imaginary constants are a GCC extension
虚数常量是一个 GCC 扩展
imaginary number in preprocessor expression
预处理表达式中出现虚数
impossible operator ‘%u’
不可能的操作‘%u’
In _cpp_valid_ucn but not a UCN
在 _cpp_valid_ucn 中但不是一个 UCN
incompatible implicit declaration of built-in function 'printf'
与内置的printf函数隐式声明不兼容。
incomplete universal character name %.*s
不完全的 Unicode 字符名 %.*s
initialization discards qualifiers from pointer target type
初始化取消了指针目标类型的限定。
initialization from incompatible pointer type
不兼容指针类型的初始化
integer constant is so large that it is unsigned
整数常量太大,认定为 unsigned
integer constant is too large for its type
整数常量值超出其类型
integer overflow in preprocessor expression
预处理表达式中整数溢出
invalid #%s directive
无效的 #%s 指示
invalid #pragma GCC poison directive
无效的 #pragma GCC poison 指示
invalid #pragma pop_macro directive
无效的 #pragma pop_macro 指示
invalid #pragma push_macro directive
无效的 #pragma push_macro 指示
invalid built-in macro \\%s\\
无效的内建宏“%s”
invalid character ‘%c’ in raw string delimiter
原始字符串分隔符中有无效字符‘%c’
invalid digit \\%c\\ in binary constant
二进制常量中有无效数字“%c
invalid digit \\%c\\ in octal constant
8 进制常量中有非法字符“%c
invalid flag \\%s\\ in line directive
line 指示中有无效的标记“%s
invalid hash type %d in cpp_macro_definition
cpp_macro_definition 中有无效的散列类型 %d
invalid prefix \\0b\\ for floating constant
浮点常量的“0b前缀无效
invalid preprocessing directive #%s
无效的预处理指示 #%s
invalid storage class for function 'XXXXXX'
在文件的某个地方,丢失了一个大括号‘}’
invalid string literal, ignoring final ‘\\\\’
无效的字面字符串,忽略最后的‘\\\\’
invalid suffix \\%.*s\\ on floating constant
浮点常量的“%.*s后缀无效
invalid suffix \\%.*s\\ on integer constant
整数常量的“%.*s后缀无效
invalid suffix \\%.*s\\ with hexadecimal floating constant
十六进制浮点常量的“%.*s后缀无效
invoking macro %s argument %d: empty macro arguments are undefined in ISO C90 and ISO C++98
调用宏 %s 的参数 %d:空的宏参数未被 ISO C90 和 ISO C++98 定义
ISO C does not permit named variadic macros
ISO C 不允许有名的可变参数宏
ISO C99 requires rest arguments to be used
ISO C99 需要使用剩余的参数
ISO C99 requires whitespace after the macro name
ISO C99 要求宏名后必须有空白
line number out of range
行号超出范围
lvalue required as left operand of assignment
左值问题
macro \\%s\\ is not used
宏“%s”未被使用
macro \\%s\\ passed %u arguments, but takes just %u
宏“%s”传递了 %u 个参数,但只需要 %u 个
macro \\%s\\ requires %u arguments, but only %u given
宏“%s需要 %u 个参数,但只给出了 %u 个
macro argument \\%s\\ would be stringified in traditional C
宏参数“%s”将在传统 C 中被字符串化
macro names must be identifiers
宏名必须是标识符
macro parameters must be comma-separated
宏参数必须由逗号隔开
missing ‘(‘ after predicate
谓词后缺少‘(’
missing ‘(‘ in expression
表达式中缺少‘(’
missing ‘)’ after \\defined\\\"
“defined 后出现‘)’
missing ‘)’ in expression
表达式中缺少‘)’
missing ‘)’ in macro parameter list
在宏参数表中缺少‘)’
missing ‘)’ to complete answer
完整的答案缺少‘)’
missing binary operator before token \\%s\\
标识符“%”s前缺少二元运算符
missing expression between ‘(‘ and ‘)’
‘(’与‘)’之间缺少表达式
missing terminating %c character
缺少结尾的 %c 字符
missing terminating > character
缺少结尾的 > 字符
missing whitespace after the macro name
宏名后缺少空白
multi-character character constant
多字节字符常量
multi-line comment
多行注释
Multiple include guards may be useful for:\\n
多个防止重包含可能对其有用:\\n
no iconv implementation, cannot convert from %s to %s
没有 iconv 的实现,无法从 %s 转换到 %s
no include path in which to search for %s
没有包含路径可供搜索 %s
no macro name given in #%s directive
#%s 指示中未给出宏名
no newline at end of file
在文件最后一行加上回车键
解释:在“Rationale for the C99 standard”一文中,有C99的相关信息:
A backslash immediately before a newline has long been used to continue string literals, as well as preprocessing command lines. In the interest of easing machine generation of C, and of transporting code to machines with restrictive physical line lengths, the C Committee generalized this mechanism to permit any token to be continued by interposing a backslash/newline sequence.
c/c++代码的每一行后面有一个“结束符”,也就是newline。避免当被include的文件展开后,前一个文件的最后一行与后一个文件的第一行直接被连接成一行从而造成错误。
non-ISO-standard escape sequence, ‘\\\\%c’
非 ISO 标准的转义序列,‘\\\\%c’
null character(s) ignored
忽略空字符
null character(s) preserved in literal
空字符将保留在字面字符串中
NULL directory in find_file
find_file 中有 NULL 目录
octal escape sequence out of range
8 进制转义序列越界
one or more PCH files were found, but they were invalid
找到一个或多个 PCH 文件,但它们是无效的
operator \\defined\\ requires an identifier
操作符“defined需要一个标识符
operator ‘%s’ has no left operand
操作符‘%s’没有左操作数
operator ‘%s’ has no right operand
操作符‘%s’没有右操作数
passing argument 1 of 'mes_read_time' discards qualifiers from pointer target type12、
mes_函数第一个参数的传递,丢弃了指针目标类型限定。
parameter name missing
缺少形参名
passing argument 1 of 'send' makes pointer from integer without a cast
函数send的第一个integer型参数没有强制转换为pointer型
pasting \\%s\\ and \\%s\\ does not give a valid preprocessing token
毗连“%s”和“%s”不能给出一个有效的预处理标识符
poisoning existing macro \\%s\\
对已存在的宏“%s”投毒
predicate must be an identifier
谓词必须是一个标识符
predicate’s answer is empty
谓词的答案为空
preprocessor arithmetic has maximum precision of %lu bits; target requires %lu bits
预处理算术的最高精度为 %lu 位;目标需要 %lu 位
raw string delimiter longer than 16 characters
原始字符串分隔符长过 16 个字符
registering \\%s\\ as both a pragma and a pragma namespace
“%s”既被注册为一个pragma 又被注册为一个 pragma 命名空间
registering pragma \\%s\\ with name expansion and no namespace
pragma “%s”被注册为一个命名扩展,而没有命名空间
registering pragma with NULL handler
pragma 注册为被 NULL 处理
registering pragmas in namespace \\%s\\ with mismatched name expansion
在命名空间“%s”中注册 pragma 时名称扩展不匹配
return makes pointer from integer without a cast
return使integer转换为pointer,没有加强制类型转换。
style of line directive is a GCC extension
line 指示的风格是一个 GCC 扩展
suffix for double constant is a GCC extension
双精度常量后缀是一个 GCC 扩展
suggest hiding #%s from traditional C with an indented #
建议使用缩进的 # 以让 #%s 对传统 C 不可见
suggest not using #elif in traditional C
建议在传统 C 中不使用 #elif
syntax error in macro parameter list
宏参数列表语法错误
target char is less than 8 bits wide
目标 char 短于 8 位
target int is narrower than target char
目标 int 短于目标 char
target wchar_t is narrower than target char
目录 wchar_t 短于目标 char
the conditional began here
条件自此开始
the left operand of \\%s\\ changes sign when promoted
“%s的左操作数在提升时变换了符号
the meaning of ‘\\\\%c’ is different in traditional C
‘\\\\%c’的意义与在传统 C 中不同
the meaning of ‘\\\\a’ is different in traditional C
‘\\\\a’的意义与在传统 C 中不同
the meaning of ‘\\\\x’ is different in traditional C
‘\\\\x’的意义与在传统 C 中不同
the right operand of \\%s\\ changes sign when promoted
“%s的右操作数在提升时变换了符号
this is the location of the previous definition
这是先前定义的位置
this use of \\defined\\ may not be portable
使用“defined可能不利于移植
token \\%s\\ is not valid in preprocessor expressions
标识符“%s”在预处理表达式中无效
too many decimal points in number
数字中有太多小数点
traditional C ignores #%s with the # indented
当 # 有缩进时传统 C 忽略 #%s
traditional C rejects the \\%.*s\\ suffix
传统 C 不接受“%.*s后缀
traditional C rejects the unary plus operator
传统 C 不接受单目 + 运算符
trigraph ??%c converted to %c
三元符 ??%c 转换为 %c
trigraph ??%c ignored, use -trigraphs to enable
三元符 ??%c 被忽略,请使用 -trigraphs 来启用
unbalanced stack in %s
%s 中堆栈不平衡
undefining \\%s\\
取消对“%s”的定义
unexpected end of file after #line
#line 后未预期的文件结束
universal character %.*s is not valid at the start of an identifier
Unicode 字符 %.*s 在标识符开头无效
universal character %.*s is not valid in an identifier
Unicode 字符 %.*s 在标识符中无效
universal character names are only valid in C++ and C99
Unicode 字符名只在 C++ 和 C99 中有效
unknown escape sequence: ‘\\\\%c’
未知的转义序列:‘\\\\%c’
unknown escape sequence: ‘\\\\%s’
未知的转义序列:‘\\\\%s’
unspellable token %s
无法拼出的标识符 %s
unterminated #%s
未终止的 #%s
unterminated argument list invoking macro \\%s\\
调用宏“%s”时参数列表未终止
unterminated comment
未结束的注释
unterminated raw string
未终止的原始字符串
use of C++0x long long integer constant
使用 C++0x long long 整数常量
use of C99 hexadecimal floating constant
使用 C99 式的 16 进制浮点常量
use -Winvalid-pch for more information
使用 -Winvalid-pch 以获得更多信息
while reading precompiled header
在读取预编译头时
while writing precompiled header
在写入预编译头时
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- ryyc.cn 版权所有 湘ICP备2023022495号-3
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务