C++ UFO Project - display_status() issue

I’m currently working on the UFO project for the C++ course, and am having trouble with compiling and executing the code. It pulls up an error saying that. on lines 19 and 37 (see below), it “could not convert ‘incorrect’ from ‘std::vector’ to ‘std::__cxx11::string {aka std::__cxx11::basic_string}’.” I have no idea what that means, or how to fix it.

#include <iostream>
#include "ufo_functions.hpp"

int main() {

  std::string codeword = "codecademy";
  std::string answer = "_________";

  int misses = 0;

  std::vector<char> incorrect;
  bool guess = false;

  char letter;

  while (answer != codeword && misses < 7) {

    display_misses(misses);

    display_status(incorrect, answer);

    std::cout << "Please enter your guess: ";
    std::cin >> letter;

    for (int l = 0; l < codeword.size(); l++) {
      if (codeword[l] == letter) {
        answer[l] = letter;
        guess = true;
      } else {
        guess = false;
      }
    }

    if (guess == true) {
      std::cout << "Correct!";
    } else {
      std::cout << "Incorrect! The tractor beam pulls the person in further.";
      incorrect.push_back(letter);
  misses++;
}

}

end_game(codeword, answer);

}

Okay, I figured out part of the problem: I hadn’t called #include <vector> at the beginning of ufo.cpp. Once I called that, however, it didn’t actually fix anything, and it’s giving me the same error.

Figured it out!
My declaration of display_status() looked a little something like this:

void display_status(std::string incorrect, std::string answer) {

And it should have looked like this (because in ufo.cpp, incorrect was declared as a char vector, not a string):

void display_status(std::vector<char> incorrect, std::string answer) {
2 Likes