Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.
You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.
Hi
You declared function ProcessGuess to accept only one argument: void ProcessGuess(FString Guess);
But when you call it in your .cpp file (line 33) you pass two arguments instead of one: ProcessGuess(Input,Lives);
Sure, it does, I will keep that in my mind for the future
So here is the code and Since, I might not be able to present my code in a way that you would like me to, but still I’ll give it a best shot.
If we look the at the header file for Bulls and Cows that is BullCowCartridge.h, we have been using this file to make certain changes or declare the functions in our main cpp file. Right?
So, what I am trying to portray here is, when I am declaring the function that is void ProcessGuess(FString Guess); , it throws an error as it is not being accepted by the compiler. SO here is the bit of the code, for better understanding.
if (Guess == HiddenWord)
{
PrintLine(TEXT(" You win !! "));
EndGame();
return;
}
So, my concern, is when, I am running or compiling the code, it throws an error stating that /Users/prateekoswal/Downloads/BullCowGame-starter-kit-2 4.26/Source/BullCowGame/BullCowCartridge.h:19:7: note: ‘ProcessGuess’ declared here
void ProcessGuess(FString Guess); // this statement is not getting accepted by the compiler
And that can be seen the screenshot as well which I pasted above. So, please if you understand, my point here, please try to help me out with this error.
bGameOver = true;
PrintLine(TEXT("\n Press Enter to Play again !! "));
}
void UBullCowCartridge::ProcessGuess(FString Guess) //// This one is the one I am talking about and is not being accepted by the complier even when I declared it in the header file.///
{
if (Guess == HiddenWord)
{
PrintLine(TEXT(" You win !! "));
EndGame();
return;
}
Yes, that is correct. The processGuess is declared only once in the header file as stated in the video. Please have a look and let me know, if I need to add anything to it.
Sorry, it’s hard to understand what you are posting.
It is very unclear.
I think we have already given you a solution.
Is what we said true?
We haven’t seen your header file, so we are guessing by the output of the error log.
How many parameters are being passed ?
EDIT:
It isn’t about how many times the function has been declared in the header file.
It’s about how many PARAMETERS are being passed into that declared function.
and by the way, you have been really helpful in the entire process. I am new to coding, that might be the reason of confusion, but I am trying to put forward my point, in best possible manner.
Re-watch the previous lectures.
If you declare a function to only accept ONE parameter,
but when it comes time to use that function you give it TWO,
then you will have an error.
EDIT:
Haha, yes, I am a newbie coder aswell.
Things like this will stick with you once they sink in.
I had issues with pointers and addresses, and had to re-watch the lectures too.
EDIT 2:
Anyway I need to go.
Best of luck.
Try modifying your code so only ONE parameter is passed into the ProcessGuess function. Something that is an FString.
Thanks for all the help i required. Well , ya, to be honest I need to re watch those videos
I’ll do what is required now and will make certain changes to the parameters passed in the ProcessGuess function as well. Hopefully it’ll work out this time