error: 'string' undeclared (first use in this function)

Ian Lance Taylor iant@google.com
Wed Oct 14 13:56:00 GMT 2009


"vinod" <vinod.nanjaiah@gmail.com> writes:

> Hi all ~
> I have #include <string.h> , but why am I still can't declare string ?
>
>
> When I compile my code ,show the error msg as follows :
> root@acer:~/probeServer# gcc probec.c -o probec -lm -lpthread
> probec.c:1:18: error: string: No such file or directory

<string> is not found.  <string> is a C++ header.  If you want C++,
compile with g++, not gcc.

Ian



More information about the Gcc-help mailing list