UFO Challenge

Hello Everybody,

This is my first post to these forums, I apologize if this is something that has been brought up prior, I attempted to search and did not see anything. So I am stuck on the 7th step of the UFO Challenge. Initially, I walked through the project fairly easily for the first few steps. However, I began getting an error while attempting to compile the project. I know I must be doing something wrong, and I really wanted to walk through this entire project myself without help. However, eventually I watched the walkthrough and followed along, although he pretty much did the exact same thing that I did in it. I made sure my code is identical to his and yet I am still getting the following error. Any and all help is appreciated! Please let me know if there is anything I can do further to help!

error message:

ufo_functions.hpp:8:20: error: variable or field ‘end_game’ declared void
void end_game(std::string answer, std::string codeword);
^~~~~~
ufo_functions.hpp:8:20: error: ‘string’ is not a member of ‘std’
ufo_functions.hpp:8:40: error: ‘string’ is not a member of ‘std’
void end_game(std::string answer, std::string codeword);

At first glance I’d suggest double-checking the headers #include(d) as string is only added to std after the necessary import (it’s not core).

You can’t use void when you call a function,
its used only when you declare the function.

An example:

#include <iostream> void say_hello() { std::cout << "Hello world!"; } int main() { // the function is called below: say_hello(); return 0; }

Thank you for both of your responses, maybe I should post my code. I removed the void where I call the function. However, it still did not work, and codecademy has void in front of it in their example also. I am not sure what is going on.

hmm … maybe the way that you call the function is an issue?
I don’t write the types when I call a function
(I usually have to declare the variable [of a specific type] and maybe give it a value before using it in a function call.)

Here’s an example of calling a function.

#include <iostream> void println(std::string text) { std::cout << text << "\n"; } int main() { std::string hello = "Hello World!"; // function is called below: println(hello); return 0; }