This lecture broke the game! [Cannot open source file "Tank.generated.h"]

So I followed the video exactly when using forward declarations etc. and now it won’t compile. Unreal throws an error on line 7 of Tank.h stating “Tank.generated.h” doesn’t exist (no such file or directory). I’ve poured over the code for the past 2 days and I can’t see anything obviously wrong. It was working, and now it’s not. The only thing I changed was to add the forward declarations exactly as in the video. I’ve watched it a couple of times since and carefully matched my code to the video and as far as I can tell my code is exactly the same.

It gets worse though. I attempted to regenerate the project files and now when I try to launch the project in Unreal I get the following message; “The following modules are missing or built with a different engine version: UE4Editor-BattleTank.dll Would you like to rebuild them now?” but when I click yes it says “BattleTank could not be compiled. Try rebuilding from source manually” and kicks me back out to the launcher.

I’m completely stuck here. Hours of searching on the net have proved fruitless so far. I have been using source control but I’m not using Source Tree as it bears absolutely no resemblance to the one Ben uses in the lecture about source control (which tbh I found very confusing and not well covered anyway). I’m not sure how to ‘roll back’ to an earlier commit in the program I’m using. I’m going to look it up now but I’d preferably like to find a solution to the above if possible so I can avoid it happening again.

Can anyone help?

Thanks.

Well, just as an update to this I can’t revert my changes. Github is complaining about unmerged files in a work tree or something. I’m now faced with the prospect of starting the section again from scratch.

Please @ben and @sampattuzzi, an updated lecture on source control would go down very well I think as I know I’m far from the only one who struggled with that part.

Also, whilst this latest turn of events is more than likely something I’ve done wrong somewhere, the whole #include and forward declaration thing in general could do with being addressed in a bit more detail nonetheless, perhaps earlier on in the course.

I’m not complaining guys - in fact far from it; I’m thoroughly enjoying this course and I’ve learned a lot from it - just offering some constructive criticism is all.

Anyway, if anyone can help identify and fix what went wrong please feel free to jump right in.

Cheers.

When this happens, it means that your code wont compile. Generate the visual studio project files (or xcode) then try to build from there to fix the errors.

This is fairly easy to fix if I know what you’ve done and what you’re trying to achieve. I’m not sure how you got there though. Are you using SourceTree? What were the step that got you there?

Hi Sam, thanks for the reply.

I’m using GitHub Desktop. I couldn’t figure Source Tree out.

The steps I took are pretty much laid out in my first post. Sorry if I’ve not been clear enough. I’ll list what happened in the order in which it happened. If you need any more info about any of the steps let me know:

  1. Followed Ben’s instructions about changing some of the #includes to forward declarations.
  2. Tried to compile from UE but got the error log pointing to line 7 of Tank.h stating “Tank.generated.h doesn’t exist (no such file or directory)”. I’m paraphrasing from memory now but that pretty much summarises it.
  3. Tried to build from VS - got a similar error regarding Tank.generated.h.
  4. Checked and re-checked the changes I’d made against the video and spent quite some time pouring over my code. Couldn’t spot anything obviously wrong.
  5. Made a commit just in case then tried to regenerate the project files.
  6. Tried to open the project in UE and got the error message; “The following modules are missing or built with a different engine version: UE4Editor-BattleTank.dll Would you like to rebuild them now?”.
  7. Clicked Yes and got the message “Starting build” but shortly afterwards it failed with the message “BattleTank could not be compiled. Try rebuilding from source manually”
  8. Double-clicked on BattleTank.uproject and tried it that way. Same error message.
  9. Tried to roll it back in GitHub Desktop by selecting my earlier commit, right-clicking choosing ‘Revert this commit’ but was met with the error message about unmerged files etc.
  10. Cracked open a beer.

I think that’s everything. It’s still not working anyway so any help or advice you can give will be greatly appreciated.

Thanks.

found any solutions? i’m having the same problems i tried rebuilding files and i got the same error message

The unmerged changes sounds like a git operation didn’t actually complete but you missed the error message.

Sorry for the late reply I’ve been away for a couple of weeks.

No I’m afraid I’ve not found any solutions. I think I’m going to have to roll back to the start of the section and begin again from there. So frustrating!

Does anyone have any insight into why this may have occurred? Is it a problem/bug with UE? I’ve poured over my code again and I still can’t see anything I’ve done wrong when compared to Ben’s edits in the video. It would be a show-stopper to get to this point the second time around and have the same problem occur again!

Quite probably. Source control confuses the hell out of me! I’ve made some headway into understanding it a bit more by reading a few tutorials and by ditching GitHub Desktop in favour of GitKraken, which although more feature-rich and cluttered still seems more user friendly and easier to understand, at least to me anyway.

Perhaps you could post the output of running “git status”

In command prompt? It just returns “git is not recognized as an internal or external command”

Or have I got that wrong?

you would need to run git bash, you can launch it from within sourcetree I think.

I’m not using sourcetree. I can’t seem to find the equivalent in GitHub Desktop.

Just install git bash and run it: https://git-scm.com/downloads

Privacy & Terms