SetupGame Function is Illegal

Hi everyone, got a bit stuck here on the CowBull game lecture I’m following. After applying all the changes now to match the lecture I’m still missing something as UE on compiling gives an illegal function error to the “UBullCowCartridge::SetupGame”

UE_SetupGame_err1_h_file

Not sure if this might be the problem, but in the EndGame(), after initializing bGameOver, you did not append it with a semi colon

Hi Saheed, the EndGame and SetupGame are functions that don’t get a semicolon. But I did give it a try and the compiler does give a different error in stating the initialization failed, so by adding the semicolon the function is changed into an initialization string.
Everything worked fine until I added the SetupGame function, so it must be something in there. I’ll just go back and start the lecture over…
Thanks

I’m still learning just like you and i wanted to see if i could use the knowledge i’ve gained so far to help people in the “ask” section. So pardon me if i’m an amateur, lol.

What i meant was: under the EndGame function, when you set bGameOver = true, a semicolon does not follow like so:
bGameOver = true; …sometimes the error messages are unhelpful, like when you miss a colon, it indicates that the error is on the next line which can be quite misleading if you’re not used to it.

And another thing i noticed about your header file was that your declared functions and variables are not indented, so they stay on the same margin as the public, protected and private access modifiers which looks unconventional to me. These might not be the solution, but until Dan gives you a response, you can try doing these. :slight_smile:

Hi Saheed, I’m in the same boat, at least you saw that missing semicolon and I’ve added it. Though the compiler result is still the same.
The header file looks the same as the one in the lecture.UE_SetupGame_err1_h_lecture

Thanks Saheed

Yahoo! got it to work. unfortunately looking at the images I shared nobody would’ve been able to help. Even though the compiler gave an error on the SetupGame sting the issue was a missing curly bracket higher up.
As I worked through the file I noticed that one of the opening curly did not have a matching closing curly in the if (bGameOver) section
Compiler happy, I’m happy, now I can go on with the course!

1 Like

Lol, i’m happy for you👌🏾

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms