Please help with simple problem [closed]
Hi, I am making a program that prints actual mood that the user sets. But I can't find on the internet the right solution of fixing an error: "no matching function for call to 'Mood::setMood(std::__cxx11::string&)'".
main.cpp
#include <iostream>
#include <Mood.h>
#include <string>
std::string input;
std::string *pInput = &input;
int main()
{
Mood mood1;
std::string input;
std::string *pInput = &input;
std::cout << "Enter mood: ";
std::cin >> *pInput;
mood1.setMood(*pInput);
std::cout << mood1.getMood() << std::endl;
return 0;
}
Mood.h
#ifndef MOOD_H
#define MOOD_H
#include <string>
class Mood
{
public:
Mood(std::string *pInput);
void setMood(std::string x);
std::string getMood();
protected:
private:
std::string mood;
};
#endif // MOOD_H
Mood.cpp
#include "Mood.h"
#include <iostream>
#include <string>
Mood::Mood(std::string *pInput)
{
std::string x;
}
void Mood::setMood(std::string x)
{
mood = x;
}
std::string Mood::getMood()
{
return mood;
}
I'm sorry, but this does not seem to be a ROS-related problem or question. It's a general C++ programming issue at this point.
Please post those on more appropriate fora, such as Stack Overflow.