A mind that is stretched by a new experience can never go back to its old dimensions.

Implicit declaration of function stpcpy

February 27th, 2010 Posted in 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. 2 Responses to “Implicit declaration of function stpcpy”

  2. By Chase Handin on Aug 30, 2011

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

  3. By Jamesina on Feb 6, 2012

    I am glad to get certainly one of various readers on this outstanding web site (:, thanks for placing up.

Post a Comment

CommentLuv badge