Download

Cannot debug brand new project

I’m trying to attach a debugger for a brand new project. I’ve followed these steps exactly:

  1. Create a new C++ project (which I have named “Shooter”) using the Unreal Editor (Version: 4.12.5-3039270+++UE4+Release-4.12) that came with the Epic Games Launcher.
  2. Build the project (no errors), using the “DebugGame Editor” configuration.
  3. Press F5 (shortcut for “Debug>Start Debugging”).

A window then pops up that says

When I click “yes”, it tries to build for about 20 seconds, and then says “Shooter could not be compiled. Try rebuilding from source manually.”.

What do I need to do to get this brand new project in a state that I can run the debugger?

Thank you.

Have you looked at the documentation?

https://docs.unrealengine.com/latest/INT/Programming/QuickStart/index.html

I followed every step to the letter, and the new project that they had me set up had the same problem. I must confess, though, I don’t see how the linked documentation is relevant to my question.

I have, however, managed to get a debugger attached to both my original project and this one, by manually attaching to the UE4 process (without the start debugging step), via Debug>Attach To Process. So unless there’s a problem with doing it that way, I think my problem is effectively solved.

Thank you for your response.

Here’s my general workflow:

  1. Create a new, blank project in UE4
  2. Goto File -> New C++ Class
  3. Fill out the class data. It can be garbage if you want to delete it. The point is to get the editor to create the class file structure for your visual studio solution.
  4. Close UE4 and open the project in visual studio
  5. Set the game to be the startup project (right click on it in solution explorer -> Set as Startup Project)
  6. Press “F5”, or right click project in solution explorer -> Debug -> Start New Instance, or press “Local Windows Debugger” button in top ribbon, or use Debug menu -> Start Debugging
  7. Code will compile. UE4 will pop up and the project will open in editor. When you press “Play in Editor” for your game, any C++ code with breakpoints in visual studio will cause the game to pause and visual studio will break on that line of code, and you can step through it, line by line and watch the variables.

I almost never need to do “Debug -> Attach to Process”, though this will work if you have debug symbols loaded on the executable you’re debugging.

Ah, so I was keeping UE4 open. Closing it does indeed enable the behavior that you’ve described. When I hit F5, the UE4 editor opens, my game starts, and there’s a debugger attached.

The only problem is that when I stop debugging, the editor closes (meaning every time I make a change to my project I’ll need to relaunch UE4). This happens when targetting both “DebugGame Editor” and “Development Editor”. Is there a way to keep it open? Or is that just a reality when running the debugger?

Thank you for your help. Getting closer!