【发布时间】:2021-11-10 21:36:00
【问题描述】:
我刚刚写了一个很简单的c文件。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
int main(int argc, char *argv[])
{
int sock = -1;
/* open raw socket */
sock = socket(PF_PACKET, SOCK_RAW, 0);
if (sock == -1)
{
printf("socket creation failed\n");
return -1;
}
/* receive packets */
/* close raw socket */
close(sock);
return 0;
}
并尝试使用命令“gcc packet_receive.c”进行编译 然后,我收到如下错误消息。
$ gcc packet_receive.c
packet_receive.c: In function emainf:
packet_receive.c:22:2: warning: implicit declaration of function eclosef; did you mean epclosef? [-Wimplicit-function-declaration]
close(sock);
^~~~~
pclose
我明白为什么我会看到这个错误。 但我想知道为什么我在错误消息中的 main、close、pclose 前面看到“e”。
有没有人看到相同类型的错误消息?
【问题讨论】:
-
有趣。尝试一些不同的控制台?可能是一些转义码被奇怪地解释了
-
'e' 和 'f' 应该是引号字符,例如
emainf应该是'main'。显然,编译器使用 unicode 字符作为引号,而终端没有将它们显示为 unicode。 -
我投票结束这个问题,因为 mojibake。见自我回答。没有必要再添加了。
标签: c linux gcc message centos8