0

I am trying to make a function that would "parseUserInput()" and my plan was to pass the user's input as an argument through the parseUserInput()'s "input" parameter. However, when I put anything into the "input" parameter, I get an error saying that there is "no matching function for call to 'parseUserInput'"

What is causing this error?

std::string branchCommand;
std::string userInputCmd;
std::string parsedInput;
std::string parseUserInput();

std::string inputCommand() {
    std::cin >> userInputCmd;
    parseUserInput(userInputCmd);

    return branchCommand;
}

std::string parseUserInput(std::string Input) {

    return parsedInput;
}
Merceus
  • 61
  • 1
  • 6

1 Answers1

0

You declared parseUserInput as std::string parseUserInput(); which doesn't allow any arguments. If you want to pass an argument then change the declaration to match the function calling and function definition.

string parseUserInput(std::string Input) // declaration

Then you can call it like this: parseUserInput(userInputCmd);

Rajeev Singh
  • 3,292
  • 2
  • 19
  • 30