devxlogo

string.h

string.h

Question:
I am a beginner with C++ programming. I was doing fine until I came to the string data type. Here is my problem:

#include #include 

This gives me errors. I know it does not have anything to do with iostream, so what could be wrong with the other header?

Answer:
You’re using the obsolete header names. Use and instead (without the ‘.h’ extension). Also, add the following using directive after the #include statements:

using namespace std;

And this should work.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist