OneLoneCoder / olcPixelGameEngine

The official distribution of olcPixelGameEngine, a tool used in javidx9's YouTube videos and projects
Other
3.82k stars 914 forks source link

experimental/filesystem: No such file or directory #302

Closed dxkyy closed 1 year ago

dxkyy commented 1 year ago

When I try to compile this file using gcc:

#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"

class Example : public olc::PixelGameEngine
{
public:
    Example()
    {
        sAppName = "Example";
    }

public:
    bool OnUserCreate() override
    {
        // Called once at the start, so create things here
        return true;
    }

    bool OnUserUpdate(float fElapsedTime) override
    {
        // called once per frame
        for (int x = 0; x < ScreenWidth(); x++)
            for (int y = 0; y < ScreenHeight(); y++)
                Draw(x, y, olc::Pixel(rand() % 255, rand() % 255, rand()% 255));    
        return true;
    }
};

int main()
{
    Example demo;
    if (demo.Construct(256, 240, 4, 4))
        demo.Start();

    return 0;
}

I get this error:

In file included from main.cpp:2:0:
olcPixelGameEngine.h:407:36: fatal error: experimental/filesystem: No such file or directory
  #include <experimental/filesystem>
                                    ^
compilation terminated.
Moros1138 commented 1 year ago

please include more details.. OS, toolchain, toolchain version, etc..

Typically when we see filesystem related issues it's because you haven't set to compile with -std=c++17 in your build command.. if you're already doing that, or doing that doesn't help, we'll need more information.

ParadoxHole commented 1 year ago

I have the same error can you explain how to set to compile with -std=c++17

OneLoneCoder commented 1 year ago

which compiler do you use?

ParadoxHole commented 1 year ago

I'm using gcc on visual studio code. Should I use an other one ?

Moros1138 commented 1 year ago

In order to give useful assistance, you'll need to provide useful information.

run gcc -v and post the output... what's your OS? other pertinent information, etc.

dxkyy commented 1 year ago

I'm using gcc 6.3.0 on Windows 10

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nls
Thread model: win32
gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)

I also tried using -std=c++17 which didn't seem to work either.

Moros1138 commented 1 year ago

You're using a bad version of MinGW.

There's instructions to install the MSYS2 version which is among the most up-to-date MinGW/GCC on windows.

https://github.com/OneLoneCoder/olcPixelGameEngine/wiki/Compiling-on-Windows-with-Other-Compilers

Good luck.

dxkyy commented 1 year ago

I followed your tutorial and I'm now able to compile it, but now I'm getting this error when trying to compile my file:

src/olcPixelGameEngine.h: In static member function 'static LRESULT olc::Platform_Windows::olc_WindowEvent(HWND, UINT, WPARAM, LPARAM)':
src/olcPixelGameEngine.h:5577:70: error: 'dbuffer' was not declared in this scope; did you mean 'dfbuffer'?
 5577 |                                         vFiles.push_back(std::string(dbuffer));
      |                                                                      ^~~~~~~
      |                                                                      dfbuffer
Moros1138 commented 1 year ago

That's because a tyoo made it into this latest version, i let javid know about it but in the meantime go into the header and fix the dbuffer typo at line 5577, it should be dfbuffer