Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #17249

Re: strcpy (s, "ABC);

From Zoltan Juhasz <zoltan.juhasz@gmail.com>
Newsgroups comp.lang.c++
Subject Re: strcpy (s, "ABC);
Date 2012-07-25 07:28 -0700
Organization http://groups.google.com
Message-ID <7879f8a1-630e-4fa7-b491-36c0b4ee8d0d@googlegroups.com> (permalink)
References <047c4d98-16ed-4acb-aee3-bcb9cc256ee1@googlegroups.com>

Show all headers | View raw


On Tuesday, 24 July 2012 20:12:07 UTC-4, gdo...@gmail.com  wrote:
> this code sample is taken from &quot;A Book on C&quot;
> 
> char s[100];
> 
> strcpy (s, &quot;ABC&quot;);
> 
> ...
> 
> the compiler issues a warning. Implicitly declaring C library function &#39;strcpy&#39; with type &#39;char*(char *,const char *)&#39;
> 
> Why does the compiler issue this warning, what does it mean, and what is the fix? compiler is LLVM 3.1


I guess you were using Clang as the C/C++ front-end. In C 
one can declare a function implicitly, by invoking the 
function. I presume that Clang is aware of the standard 
function 'strcpy', and issued a warning that you implicitly 
declared a C library function.

Solution: have the 'string.h' header included in your 
relevant source code file(s).


PS: this is a very common problem, you should have used
Google first.

-- Zoltan

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

strcpy (s, "ABC); gdotone@gmail.com - 2012-07-24 17:12 -0700
  [OT] Re: strcpy (s, "ABC); Paavo Helde <myfirstname@osa.pri.ee> - 2012-07-25 01:35 -0500
    Re: [OT] Re: strcpy (s, "ABC); Juha Nieminen <nospam@thanks.invalid> - 2012-07-25 09:55 +0000
      Re: [OT] Re: strcpy (s, "ABC); Paavo Helde <myfirstname@osa.pri.ee> - 2012-07-25 15:20 -0500
      Re: [OT] Re: strcpy (s, "ABC); Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-07-25 21:16 +0000
        Re: [OT] Re: strcpy (s, "ABC); Juha Nieminen <nospam@thanks.invalid> - 2012-07-26 05:19 +0000
          Re: [OT] Re: strcpy (s, "ABC); Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-07-26 09:30 +0000
  Re: strcpy (s, "ABC); Zoltan Juhasz <zoltan.juhasz@gmail.com> - 2012-07-25 07:28 -0700
  Re: strcpy (s, "ABC); Varun Tewari <tewari.varun@gmail.com> - 2012-07-25 10:04 -0700

csiph-web