PlayGame identifier not found? main.h disappearing?

Seems my code has gotten rather messy. I was trying to over-reach a bit I think. I tried to follow the instructions but got a PlayGame identifier not found error. I tried to change all my code to match, taking out the fancy stuff, and I found that I didn’t have main.h under header files like it was meant to be. Here are screenshots of my code in its current state.

So you don’t have a main.h, correct?
Then it simply looks like you have forgotten to declare the PlayGame function before using it in the main, unlike the other functions. :slight_smile:

So I hopped on before work today to see if I could figure it out and now, every time I load up, start debugging and start without debugging are grey. I did some looking and found I could fix this by launching from the file specifically instead of launching from recent files, but do you know of a way I can sort that out without having to go through a workaround. The problem seems to be that it’s launching the project but not putting the solution in the solution explorer, as you can see in this screenshot.


I’m not sure why I’m suddenly having all these issues in succession.

Ok, having now declared PlayGame as a function, I’m seeing the error “PlayGame function does not take 2 arguments”. Now I’m left to suspect that something about the way I’ve used Number_Of)Turns and/or RemainingG is wrong. I notice I have both declared inside the main function. Perhaps I could declare them inside the PlayGame function? Would they then still be arguments taken inside the main function? I think I need to go back and remind myself how to write arguments properly. I’ll do that after work.

You are declaring the function ‘void PlayGame()’, but the one you define below is ‘void PlayGame(const int&, int&)’ and is not the same thing: the number and type of arguments is part of the function signature!
So these two functions — PlayGame that takes two arguments, and PlayGame that takes no arguments — could both exist in the code and do different things…

Regarding your problem with Visual Studio, sorry, I’m not using it so I don’t know it well. Good luck!

You need to be opening the project not the file.

After taking your advice, it seems to be working fine. I still don’t have any header file in my solution explorer but I don’t think that’s going to be an actual problem. Thank you so much for all your help! Here’s what my code looks like in case anyone else is looking around for a similar problem to mine.

Thank you! Any idea why my header file isn’t appearing in my solution explorer?

What’s in it and and why do you have main.h

In the lecture, at 3:20, he uses extract function. Afterward it created a header file automatically. In his, the header file shows up in the solution explorer. In mine, it doesn’t.



I was just wondering why that might be. I might open a new post for this specific question

What’s in your source folder?