"string is not a member of std" error.

I do not understand why it gives me this error in the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "stdafx.h"
#include "ZerpAlarm.h"
#include <cstring>

class ZerpAlarm final
{
private:
	std::string stratimes[2];
	std::string straMessages[2];

public:
	ZerpAlarm();
	ZerpAlarm(const std::string* t, const std::string* m);
};


Do any of you see what's wrong?
Last edited on
You included <cstring> instead of <string>.
But I wanted to start using cstring instead since I guess that's better for C++.
Or am I wrong? How do you use cstrings then?

I even changed to "#include <string>" now and I still get the same error.
Last edited on
@Zerpent
But I wanted to start using cstring instead since I guess that's better for C++.


What is cstring?!

As for the header file named cstring in C++ programs then it contains declarations of standard C functions as for example strlen.

It seems that you get the error again because it is possible that inside header file "ZerpAlarm.h" there are also some references to std::string. If so then you should include <string> also in this file.
There are three headers which is probably the cause of your confusion:
1
2
3
#include <string.h>  // This contains utilities for modifying c-style string
#include <cstring> // This is the C++ version of the library above.  It effectively just puts everything in std::
#include <string>// this contains the std::string class. 
Last edited on
Well, I started a new project and I use <string> again. Now it works.

Sorry for my confusion and thanks for the help.
Topic archived. No new replies allowed.