Handmade Hero»Forums»Code
Jay
4 posts
Debugging a file in vs that was created in the cmd
Edited by Jay on
Hi I am on video 2.

It looks like Casey builds the program using cl but debugs it in Visual studio using breakpoints and stepping through code without having to actually build it through Visual Studio. In what video does he go through how to set up Visual Studio like that?
I'm used to program and debug on my mac using gdb and lldb so I'm lost when it comes to windows and this ide stuff. Thanks for your help!

Optional info about the problem I'm having:
I get a casting error when building the program in visual studio that I don't get when building the program using cl in the command line. However, when I fix the problem so that it compiles in Visual Studio it stops compiling in cl.

For example the line:
WindowClass.lpszClassName = "HandmadeWindowClass";
compiles fine using cl but generates the error
Error C2440 '=': cannot convert from 'const char [20]' to 'LPCWSTR'
when building in visual studio.
If I cast the string to (LPCWSTR) it works in Visual Studio but the cl compiler halts with the error
Error C2440: '=': cannot convert from 'LPCWSTR' to 'LPCSTR'
504 posts
Debugging a file in vs that was created in the cmd
you pass the path to the executable as argument when you launch Visual Studio. This creates a dummy project which lets you launch and debug the application.

As for your error it's because somewhere the UNICODE macro got defined and made windows assume you wanted to use 16-bit char strings

You can force the old 8-bit version by changing the type of the WNDCLASS variable to WNDCLASSA, also make sure to call RegisterClassA.
Jay
4 posts
Debugging a file in vs that was created in the cmd
Thank you! Works like a charm.
I could even pass the source files to be able to put breakpoints and stuff. :)
Now I don't even have to deal with project clutter.
Jim R. Didriksen
63 posts
Debugging a file in vs that was created in the cmd
https://hero.handmadedev.org/videos/win32-platform/day001.html

This is where he sets up the windows build.