I have three short files which I adapted from my project because they reproduce the errors I am having:
exp.cpp
#include <iostream>
using namespace std;
int main(){
cout << "Hello world!" << endl;
}
parser.cpp
#include <cstring>
#include "parser.h"
parser.h
#ifndef PARSER_H_
#define PARSER_H_
#include <cstring>
class Parser{
public:
Parser(std::string*);
std::string* unprocessedInput;
};
#endif /* PARSER_H_ */
When I build the project, at the line,
Parser(std::string*)
I get the error message "expected ‘)’ before ‘*’ token" and at the line,
std::string* unprocessedInput;,
I get the error "‘string’ in namespace ‘std’ does not name a type".
When I use <string> instead of <cstring> in either parser.cpp or parser.h, the project builds. I want to understand why <cstring> is not working. I need to work with null-terminated strings in my project.
Note that I have searched extensively for this. In my research I got the idea of using std::string instead of a string in a header file.