Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 63568  / 2 Years ago, tue, november 15, 2022, 3:29:59

I wrote the program kai.c and now am trying to compile it with gcc kai.c -o kai, which returns:



kai.c:5:18: fatal error: string: No such file or directory
#include <string>
^
compilation terminated.


What can I do?



gcc version is: (Ubuntu 4.8.2-19ubuntu1) 4.8.2

More From » gcc

 Answers
3

C


The string library is the file string.h, so:


#include "string.h"

Example:


#include "string.h"
#include "stdio.h"

void main(){
char src[2] = "Hi";
char dest[2];
strcpy(dest, src);
printf("%s
", dest); // Will print Hi
}

[#22244] Wednesday, November 16, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
scusaper

Total Points: 335
Total Questions: 111
Total Answers: 119

Location: Belize
Member since Mon, Jun 20, 2022
2 Years ago
scusaper questions
Fri, Apr 15, 22, 15:26, 2 Years ago
Wed, Mar 15, 23, 03:53, 1 Year ago
Sat, Jun 4, 22, 18:03, 2 Years ago
;