Feb 27

Implicit declaration of function stpcpy

Category: from the road

A very irritating compiler warning:

tarc.c:174: warning: implicit declaration of function “stpcpy”
tarc.c:174: warning: incompatible implicit declaration of built-in
function “stpcpy”

No clear way to fix it. Upon first thought you
#include string.h

But that doesn’t work.

The only workaround is to add a function prototype to your .h file or
to the top of your .c file:
//function prototype for external function
extern char *stpcpy (char *__dest, const char *__src);

This declaration is the fix you need to supress that warning. Stpcpy
is extern’d from usr/include/string.h

Stpcpy: http://www.opengroup.org/onlinepubs/9699919799/functions/stpcpy.html

1 comment

1 Comment so far

  1. Chase HandinNo Gravatar August 30th, 2011 1:22 pm

    You should really add bookmarking widget to this page, so I could re-post it on my Twitter.

Leave a comment

CommentLuv badge