gpt4 book ai didi

c - STDERR_FILENO 在 ubuntu 上未声明

转载 作者:太空狗 更新时间:2023-10-29 17:20:37 32 4
gpt4 key购买 nike

我正在尝试编译 an example stack trace displaying code .当我编译 test.c 文件时:

gcc -g -rdynamic ./test.c -o test

我收到以下错误:

./test.c: In function ‘handler’:
./test.c:16: error: ‘STDERR_FILENO’ undeclared (first use in this function)
./test.c:16: error: (Each undeclared identifier is reported only once
./test.c:16: error: for each function it appears in.)

我的include和原来的post code一样:

#include <stdio.h>
#include <execinfo.h>
#include <signal.h>
#include <stdlib.h>

我的机器是 ubuntu 13.04。我是否缺少某些库或没有包含某些内容?

最佳答案

还有 #include <unistd.h> .

查看此 GNU documentation .

关于c - STDERR_FILENO 在 ubuntu 上未声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21231020/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com