Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

STDERR_FILENO undeclared on ubuntu

Tags:

c

stdio

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?

like image 883
ducin Avatar asked Jan 20 '14 10:01

ducin


1 Answers

Also #include <unistd.h>.

See this GNU documentation.

like image 124
trojanfoe Avatar answered Sep 19 '22 15:09

trojanfoe