C++ Fundamentals: Dapper Dasher not running properly

I recently started the C++ Fundamentals course, currently on section 3, Dapper Dasher. When I try to debug the program, as instructed in the videos, the window opens but it is stuck buffering. Here is my code.

#include “raylib.h”

int main()

{

//window dimensions

const int windowWidth {512};

const int windowHeight {380};



//initialize the window

InitWindow(windowWidth, windowHeight, "Dapper-Dasher");

//rectangle dimensions

const int width {50};

const int height {80};

int posY {windowHeight - height};

int velocity {0};



SetTargetFPS (60);

while (!WindowShouldClose());

{

    //begin drawing

    BeginDrawing();

    ClearBackground(WHITE);

   

    IsKeyPressed (KEY_SPACE);

    {

        velocity -= 10;

    }

   

    posY += velocity;

    DrawRectangle  (windowWidth/2, posY, width, height, BLUE);

    //end drawing

    EndDrawing();

}

CloseWindow();

}

Here is the text from the debug console:

=thread-group-added,id=“i1”
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param=“pagination”,value=“off”
[New Thread 15608.0x1038]
[New Thread 15608.0x3a78]
[New Thread 15608.0xf80]

Thread 1 hit Breakpoint 1, main () at Dasher.cpp:6
6 const int width {512};
Loaded ‘C:\WINDOWS\SYSTEM32\ntdll.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\kernel32.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\KernelBase.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\gdi32.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\win32u.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\gdi32full.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\msvcp_win.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\ucrtbase.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\user32.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\msvcrt.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\shell32.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\SYSTEM32\winmm.dll’. Symbols loaded.
Loaded ‘C:\WINDOWS\System32\imm32.dll’. Symbols loaded.
[New Thread 15608.0x2f4]
[New Thread 15608.0x3f40]
=library-unloaded,id=“C:\WINDOWS\SYSTEM32\kernel.appcore.dll”,target-name=“C:\WINDOWS\SYSTEM32\kernel.appcore.dll”,host-name=“C:\WINDOWS\SYSTEM32\kernel.appcore.dll”,thread-group=“i1”
[New Thread 15608.0x1bf4]
=library-unloaded,id=“C:\Windows\System32\AppXDeploymentClient.dll”,target-name=“C:\Windows\System32\AppXDeploymentClient.dll”,host-name=“C:\Windows\System32\AppXDeploymentClient.dll”,thread-group=“i1”
[New Thread 15608.0x239c]
[New Thread 15608.0x3f88]
[New Thread 15608.0x358c]
[Thread 15608.0x239c exited with code 0]
[Thread 15608.0x3f88 exited with code 0]
[Thread 15608.0x358c exited with code 0]
[New Thread 15608.0x3fd0]
[New Thread 15608.0x396c]
[New Thread 15608.0x3c58]
=library-unloaded,id=“C:\WINDOWS\System32\psapi.dll”,target-name=“C:\WINDOWS\System32\psapi.dll”,host-name=“C:\WINDOWS\System32\psapi.dll”,thread-group=“i1”
=library-unloaded,id=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,target-name=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,host-name=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,thread-group=“i1”
=library-unloaded,id=“C:\WINDOWS\System32\psapi.dll”,target-name=“C:\WINDOWS\System32\psapi.dll”,host-name=“C:\WINDOWS\System32\psapi.dll”,thread-group=“i1”
=library-unloaded,id=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,target-name=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,host-name=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,thread-group=“i1”
=library-unloaded,id=“C:\WINDOWS\System32\psapi.dll”,target-name=“C:\WINDOWS\System32\psapi.dll”,host-name=“C:\WINDOWS\System32\psapi.dll”,thread-group=“i1”
=library-unloaded,id=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,target-name=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,host-name=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,thread-group=“i1”
=library-unloaded,id=“C:\WINDOWS\System32\psapi.dll”,target-name=“C:\WINDOWS\System32\psapi.dll”,host-name=“C:\WINDOWS\System32\psapi.dll”,thread-group=“i1”
=library-unloaded,id=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,target-name=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,host-name=“C:\WINDOWS\SYSTEM32\dbghelp.dll”,thread-group=“i1”
[New Thread 15608.0x2430]
[New Thread 15608.0x77c]
[New Thread 15608.0x2330]
[Thread 15608.0x396c exited with code 0]
[Thread 15608.0x3a78 exited with code 0]
[Thread 15608.0xf80 exited with code 0]
[Thread 15608.0x1038 exited with code 0]
[Thread 15608.0x2f4 exited with code 0]
[Thread 15608.0x3f40 exited with code 0]
[New Thread 15608.0x393c]
[New Thread 15608.0x3a54]
[Thread 15608.0x3a54 exited with code 0]
[Thread 15608.0x393c exited with code 0]
[New Thread 15608.0x2784]
[Thread 15608.0x77c exited with code 0]
[Thread 15608.0x2330 exited with code 0]

Additionally, vsc notes this issue with my code, but I don’t know how to resolve it:

this ‘while’ clause does not guard… [-Wmisleading-indentation]

Hi, welcome to the community!

Remove the “;” in here. The “;” makes an empty statement that becomes the body of your while loop, and so the while loop only repeats this empty statement forever. Your execution never reaches the code block that you intended to be repeated, starting with the “{” below the “while”.

Thanks very much!

Privacy & Terms