Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dwfunk4475

Pages: [1]
1
Window / Re: trouble running sample code from tutorial
« on: May 09, 2025, 03:02:13 am »
OK, thanks for the feedback.
C++17 is set, or so I thought, I'll have to figure out why it's not working.

Code: [Select]
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:/SFML/include",
                "C:\\SFML\\include\\SFML\\Window",
                "C:\\SFML\\include\\SFML\\Graphics"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.22621.0",
            "compilerPath": "cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

2
Window / Re: trouble running sample code from tutorial
« on: May 04, 2025, 06:06:30 pm »
C++ is set. IDE is VS Code

terminal output:

Code: [Select]
Executing task: C/C++: g++.exe build active file

Starting build...
cmd /c chcp 65001>nul && C:\msys64\mingw64\bin\g++.exe -fdiagnostics-color=always -g C:\VSCode_Projects\Timber\myWindow.cpp -o C:\VSCode_Projects\Timber\myWindow.exe
C:\VSCode_Projects\Timber\myWindow.cpp: In function 'int main()':
C:\VSCode_Projects\Timber\myWindow.cpp:11:36: error: qualified-id in declaration before 'event'
   11 |         while (const std::optional event = window.pollEvent())
      |                                    ^~~~~
C:\VSCode_Projects\Timber\myWindow.cpp:14:17: error: 'event' was not declared in this scope
   14 |             if (event->is<sf::Event::Closed>())
      |                 ^~~~~
C:\VSCode_Projects\Timber\myWindow.cpp:14:46: error: expected primary-expression before ')' token
   14 |             if (event->is<sf::Event::Closed>())
      |                                              ^

Build finished with error(s).

 *  The terminal process terminated with exit code: -1.
 *  Terminal will be reused by tasks, press any key to close it.



3
Window / trouble running sample code from tutorial
« on: May 03, 2025, 08:41:45 am »
Windows 11, MingW64, built SFML.

On the tutorial "Opening and managing an SFML window". Running the sample code, I get the error "event was not declared in this scope."
What have I overlooked?



Code: [Select]

#include <SFML/Window.hpp>


int main()
{
    sf::Window window(sf::VideoMode({800, 600}), "My window");


    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        while (const std::optional event = window.pollEvent())
        {
            // "close requested" event: we close the window
            if (event->is<sf::Event::Closed>())
                window.close();
        }
    }
}

Pages: [1]