No such file or directory #include <string> [closed]

Solution 1:

#include <string> is a C++ directive.

Rename your file to kai.cpp

And compile it with g++ kai.cpp -o kai

Solution 2:

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\n", dest); // Will print Hi
}