문제

I'm trying to compile an example stack trace displaying code. When I compile the test.c file with:

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

I get following error:

./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.)

My includes are the same as in the original post code:

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

My machine is ubuntu 13.04. Am I missing some library or haven't included something?

도움이 되었습니까?

해결책

Also #include <unistd.h>.

See this GNU documentation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top