Reputation: 635
I am trying to compile old project, but I got an error. That project implements function dprintf
, which is some kind of a printf
function. However when I tried to compile that project today I found out that dprintf
is already defined in stdio.h
. So my question is - how to hide the standard dprintf
function, because now I'm constantly getting an error like this:
ntreg.c:82: error: conflicting types for 'dprintf'
/usr/include/stdio.h:397: note: previous declaration of 'dprintf' was here
ntreg.c:93: error: conflicting types for 'dprintf'
/usr/include/stdio.h:397: note: previous declaration of 'dprintf' was here
Upvotes: 0
Views: 423
Reputation: 108978
dprintf()
is not defined by the Standard.
If you configure your compiler for Standard C, the function should no longer be exposed
gcc -std=c99 -pedantic ...
Upvotes: 6
Reputation: 53006
Just rename your implementation to something else like
int dprintf(... parameters ...)
to
int not_stdio_dprintf(... parameters ...)
and then wherever you use it add
#define dprintf not_stdio_dprintf
Upvotes: 4