• Tags
  • C

String.h Header File

Latest response

I am running RHEL workstation 7.3 and I installed Development Tools to get access to gcc and g++ compiler. As part of development tools there was also this file string.h that was installed in my /usr/include/ folder that wasnt there before. Now the problem is that I am unable to use this header file in any of my c programs that I want to compile and execute. When I try to compile my c program I get an error

/usr/include/string.h:409:14: error: expected identifier or ‘(’ before string constant
extern char *strerror (int __errnum) __THROW

Does anybody know the source of this file ?

Responses

Please run:

rpm -qf /usr/include/string.h

It should identify the RPM package that brought that file to your system.

On a normal RHEL workstation, it should be glibc-headers-2.17-157.el7.x86_64.rpm (or possibly a newer RPM version of that).

Note that string.h provides support for ISO C99 and C++ strings; if your compiler options choose a C standard older than C99, you might have problems. So if you use string.h, your compiler options should include -std=c99 or greater.

Note that the default is -std=gnu90 (i.e. ISO C90 + only some C99 features available as GNU extensions), and the latest C standard version would be -std=c11, although it is only experimentally supported on RHEL7 standard gcc. If you have a RHEL Developer subscription, you could get gcc version 5.3 as part of the Red Hat Developer Tool Set.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.