Unexpected error, lecture 37

Hey all,

So I’m at the break point step of this lecture and my debugger is returning this:

Guess[MHWChar] == MyHiddenWord[MHWChar] identifier “MHWChar” is undefined

I imagine my problem is somewhere from lecture 33, but I can’t spot it. Anybody else run into this problem, or just know a common mistake that might be causing it?

Thanks,

Jason

It means it doesn’t know what MHWChar is because you didn’t define it. Maybe you misspelled your variable for your loop or used a different name for it?

I’m absolutely sure I made a mistake somewhere, but I just can’t find it. Whenever I peek the definition it just takes me right back to these lines:

I’m not sure we defined “MHWChar” anywhere else in the solution.

If you are in the debugger, it means it compiled ok. There are a few possibilities:

  1. It needs a recompile. The debugger might be seeing an old version of the code instead of the current version.

  2. The optimizer optimized the variable away. That makes debugging harder when that happens. I am sure VS2015 and/or xCode has a way to turn the optimization off, but I don’t know what it is right now. That might not be a good idea, as Unreal might then run too slowly to debug.

A temporary solution to #2 is to add a line to print the value of MHWchar. That would force it to not be optimized away.

Sorry, I misread/understood what you meant. I believe you are talking about having added Guess[MHWChar] == MyHiddenWord[MHWChar] to your watch list and are at a breakpoint before the scope of MHWChar. In which case MHWChar wouldn’t exist yet so it’s undefined until you reach that scope.

Yeah, that was my bad for not posting the code.

It doesn’t seem to be impacting the game’s performance in any way. I think I spent a day and a half chasing my tail on nothing. Every coder’s been there at some point, right?

Privacy & Terms