Domanda

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?

È stato utile?

Soluzione

Also #include <unistd.h>.

See this GNU documentation.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top