Handmade Hero»Forums»Code
Stanley
2 posts
Visual Studio Attach?
I just recently found out about this project and have started to catch up on the videos. Everything has been going well until my Visual Studio Debug button randomly got replaced by an Attach button. I don't know what process I'm supposed to attach to or why it switched all of the sudden, but it won't let me debug anymore.

Thanks for any help anyone can provide.
Chris
21 posts
Visual Studio Attach?
If you don't have a solution loaded in Visual Studio it will behave as you describe. Are you using VS as your editor or simply as your debugger (like Casey does)?
Stanley
2 posts
Visual Studio Attach?
I have been using in like Casey does. I have had no problems up till day 6 debugging like usual. Then I loaded some of Casey's code to compare to mine and it came up with the attach button. When I loaded my code back in it was still stuck on attach.
Visual Studio Attach?
Edited by Class GenericHuman on
So, for some reason the .bat files don't work properly for me as well. I'm not sure why, but their effects only last in that cmd window. That is, if I open a cmd window and add something to the path, that addition can only be used in that cmd window. So if I close it and relaunch cmd, the path resets.

Because of this reason, I made some changes to the batch files. I'm doing this in the C:/HandmadeHero folder. So I put a shortcut to it on the desktop. Then inside that (where you put the handmade folder), I have a setupHandmade.bat file with the following code.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
REM Start
@echo off
subst w: c:/HandmadeHero

REM subst the fake drive 

w:

REM go inside w:/handmade/code and call build.bat

cd handmade
cd code
call build.bat
start notepad++ handmade.cpp
cd ..
cd ..
cd build

REM Call devenv with the exe name.

devenv win32_handmade.exe

REM End


This does everything for me. It:
1. Creates the w: drive.
2. Runs the build.bat
3. Opens my editor of choice
4. Run devenv with the require argument to load the solution.

Now, as I said, the changes made in the PATH aren't sticky, so if I run the build.bat from inside Notepadd++, it wouldn't work because everything shell.bat does has been reset. So, I run shell.bat everytime from inside the build.bat batch file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
REM Start

@echo off

REM make sure the command line is in w:/

c:
w:
cd w:/

REM Run shell.bat as its effects only last in that cmd window

cd handmade
cd misc
call shell.bat
cd ..
cd code

REM Do the building.

set CommonCompilerFlags=-MTd -nologo -Gm- -GR- -EHa- -Od -Oi -WX -W4 -wd4201 -wd4100 -wd4189 -wd4505 -DHANDMADE_INTERNAL=1 -DHANDMADE_SLOW=1 -DHANDMADE_WIN32=1 -FC -Z7
set CommonLinkerFlags= -incremental:no -opt:ref user32.lib gdi32.lib winmm.lib

REM TODO - can we just build both with one exe?

IF NOT EXIST ..\..\build mkdir ..\..\build
pushd ..\..\build

REM 32-bit build
REM cl %CommonCompilerFlags% ..\handmade\code\win32_handmade.cpp /link -subsystem:windows,5.1 %CommonLinkerFlags%

REM 64-bit build
del *.pdb > NUL 2> NUL
cl %CommonCompilerFlags% ..\handmade\code\handmade.cpp -Fmhandmade.map -LD /link -incremental:no -opt:ref -PDB:handmade_%random%.pdb -EXPORT:GameGetSoundSamples -EXPORT:GameUpdateAndRender
cl %CommonCompilerFlags% ..\handmade\code\win32_handmade.cpp -Fmwin32_handmade.map /link %CommonLinkerFlags%
popd

REM End


New CMD Calls:
1) start :- execute the argument and give back control to the batch file.
2) call:- call a batch file from another batch file and tell windows that after the child batch file completes, the parent batch file must continue
3) REM: remark. Like comments.
Roderic Bos
70 posts
Visual Studio Attach?
If you download the latest solution from this thread the dynamic loading game update works fine with visual studio

(Also see remarks about pdb renaming)

https://forums.handmadehero.org/i...hp/forum?view=topic&catid=4&id=77