Having problems with debugging in Visual Studio

When i use devenv win32_handmade.exe, it only loads the win32_handmade.cpp file as well as a the disassembly tab. I am unsure about how to view the other files in the project - opening handmade.cpp with file-open-file and set a breakpoint, visual studio gives me the warning "the breakpoint will not currently be hit. No symbols have been loaded for this Document.".
How do i work around that? when casey opens visual studio on stream, he always has all the project files open immediately.

I have another problem - when i want to use the live-code-editing thins, i get an error: "LINK: fatal error LNK1104: cannot open file 'win32_handmade.exe' - however the error somehoe doesnt have any impact, the changes i make in the sourcecode still apply to the running program without any issues.

I use the exact sourcecode and build.bat file from the zip-file.
Can someone help me with this?
For your first problem:
1) Right click on win32_handmade in your solution explorer. Choose 'Debug' then 'Step into new Instance'.
2) Search(Ctrl+F) for 'Game.UpdateAndRender' and set a breakpoint there. Press the yellow 'Continue' button. Once it stops at the line:
1
Game.UpdateAndRender(&Thread, &GameMemory, NewInput, &Buffer);
, press F11. You will get 'handmade.cpp'.
3) Above where the code is, you will see the names of both files, 'win32_handmade.cpp' and 'handmade.cpp'. If 'handmade.cpp' is on right side (different color from 'win32_handmade.cpp', drag the name towards 'win32_handmade.cpp'.

You can also use
1
devenv win32_handmade.exe "../handmade/code/handmade.cpp"

instead of
1
devenv win32_handmade.exe

in your batchfile/cmd. You can add other files you want to open after the exe.

For your second problem:
When you are building the project while the exe is running, the compiler cannot open the exe(as Visual Studio will not allow that). Hence the error 'cannot open'. This is also the reason Casey mucks around with the pdb files of the dll (Visual Studio just will not files go).

Edited by Class GenericHuman on
The LINK error is normal: when you build handmade hero there are 2 compiles, one for win32_handmade.exe and one for handmade.dll.

The game code (handmade.cpp) is compiled in a dll and as we load a copy of the dll in the game (handmade_temp.dll), the linker can overwrite handmade.dll. Then we can unload handmade_temp.dll, copy the new handmade.dll to handmade_temp.dll and load it.

The platform code (win32_handmade.cpp) can not be linked if the game (win32_handmade.exe) is running because it has to overwrite win32_handmade.exe. As gameplay code is in the dll there is no problem with that.

For the other issue, you can open a file in visual studio and set a breakpoint. At least it works for me.

A few things that might help:
- if you try to debug after live-code-editing, the symbols may not load correctly. I posted about that here.
- check in the build folder if there is a win32_handmade.pdb and handmade_xxxxx.pdb (where xxxxx is a random number that changes each time you build). handmade_xxxxx.pdb is the debug symbols file for the handmade.cpp (the dll code).
- you may need to open the file in a "W:\" path.
- if you save the visual studio solution (.sln), the next time you debug it should restore opened files and tabs.

Hope this helps.
Thanks alot! I now have a batchfile to run devenv with the files i want it to open in it, works perfectly :)