Error when trying to make
Fiuse opened this issue · 2 comments
Fiuse commented
When trying to make the program I get the following error:
In file included from ./draw_png.h:9,
from main.cpp:2:
././colors.h:123:22: error: ‘filesystem’ in namespace ‘std’ does not name a type
123 | bool load(const std::filesystem::path &, Palette *);
| ^~~~~~~~~~
././colors.h:123:39: error: expected unqualified-id before ‘&’ token
123 | bool load(const std::filesystem::path &, Palette *);
| ^
././colors.h:123:38: error: expected ‘)’ before ‘&’ token
123 | bool load(const std::filesystem::path &, Palette *);
| ~ ^~
| )
././colors.h:123:39: error: non-member function ‘bool Colors::load(...)’ cannot have ref-qualifier
123 | bool load(const std::filesystem::path &, Palette *);
| ^
././colors.h:123:50: error: expected initializer before ‘*’ token
123 | bool load(const std::filesystem::path &, Palette *);
| ^
././colors.h:124:22: error: ‘filesystem’ in namespace ‘std’ does not name a type
124 | bool load(const std::filesystem::path &, const std::vector<string> &filter,
| ^~~~~~~~~~
././colors.h:124:39: error: expected unqualified-id before ‘&’ token
124 | bool load(const std::filesystem::path &, const std::vector<string> &filter,
| ^
././colors.h:124:38: error: expected ‘)’ before ‘&’ token
124 | bool load(const std::filesystem::path &, const std::vector<string> &filter,
| ~ ^~
| )
././colors.h:124:39: error: non-member function ‘bool Colors::load(...)’ cannot have ref-qualifier
124 | bool load(const std::filesystem::path &, const std::vector<string> &filter,
| ^
././colors.h:124:42: error: expected unqualified-id before ‘const’
124 | bool load(const std::filesystem::path &, const std::vector<string> &filter,
| ^~~~~
In file included from ././settings.h:5,
from ./draw_png.h:11,
from main.cpp:2:
./././worldloader.h:74:24: error: ‘filesystem’ in namespace ‘std’ does not name a type
74 | void load(const std::filesystem::path ®ionDir);
| ^~~~~~~~~~
./././worldloader.h:74:41: error: expected unqualified-id before ‘&’ token
74 | void load(const std::filesystem::path ®ionDir);
| ^
./././worldloader.h:74:40: error: expected ‘)’ before ‘&’ token
74 | void load(const std::filesystem::path ®ionDir);
| ~ ^~
| )
./././worldloader.h:74:41: error: expected ‘;’ at end of member declaration
74 | void load(const std::filesystem::path ®ionDir);
| ^
| ;
./././worldloader.h:74:42: error: ‘regionDir’ does not name a type
74 | void load(const std::filesystem::path ®ionDir);
| ^~~~~~~~~
./././worldloader.h:75:30: error: ‘filesystem’ in namespace ‘std’ does not name a type
75 | void loadRegion(const std::filesystem::path ®ionFile, const int regionX,
| ^~~~~~~~~~
./././worldloader.h:75:47: error: expected unqualified-id before ‘&’ token
75 | void loadRegion(const std::filesystem::path ®ionFile, const int regionX,
| ^
./././worldloader.h:75:46: error: expected ‘)’ before ‘&’ token
75 | void loadRegion(const std::filesystem::path ®ionFile, const int regionX,
| ~ ^~
| )
./././worldloader.h:75:47: error: expected ‘;’ at end of member declaration
75 | void loadRegion(const std::filesystem::path ®ionFile, const int regionX,
| ^
| ;
./././worldloader.h:75:48: error: ‘regionFile’ does not name a type
75 | void loadRegion(const std::filesystem::path ®ionFile, const int regionX,
| ^~~~~~~~~~
In file included from ./draw_png.h:11,
from main.cpp:2:
././settings.h:19:8: error: ‘filesystem’ in namespace ‘std’ does not name a type
19 | std::filesystem::path saveName, outFile, colorFile;
| ^~~~~~~~~~
././settings.h:59:8: error: ‘filesystem’ in namespace ‘std’ does not name a type
59 | std::filesystem::path regionDir() {
| ^~~~~~~~~~
././settings.h: In constructor ‘Settings::WorldOptions::WorldOptions()’:
././settings.h:40:5: error: ‘saveName’ was not declared in this scope
40 | saveName = "";
| ^~~~~~~~
././settings.h:42:5: error: ‘outFile’ was not declared in this scope
42 | outFile = "output.png";
| ^~~~~~~
././settings.h:43:5: error: ‘colorFile’ was not declared in this scope
43 | colorFile = "colors.json";
| ^~~~~~~~~
In file included from main.cpp:2:
./draw_png.h: At global scope:
./draw_png.h:84:20: error: ‘filesystem’ in namespace ‘std’ does not name a type
84 | Image(const std::filesystem::path file, const IsometricCanvas &canvas,
| ^~~~~~~~~~
./draw_png.h:84:37: error: expected unqualified-id before ‘file’
84 | Image(const std::filesystem::path file, const IsometricCanvas &canvas,
| ^~~~
./draw_png.h:84:36: error: expected ‘)’ before ‘file’
84 | Image(const std::filesystem::path file, const IsometricCanvas &canvas,
| ~ ^~~~~
| )
./draw_png.h:84:32: error: expected ‘;’ at end of member declaration
84 | Image(const std::filesystem::path file, const IsometricCanvas &canvas,
| ^~~~
| ;
./draw_png.h:84:37: error: ‘file’ does not name a type
84 | Image(const std::filesystem::path file, const IsometricCanvas &canvas,
| ^~~~
main.cpp: In function ‘int main(int, char**)’:
main.cpp:50:8: error: ‘std::filesystem’ has not been declared
50 | std::filesystem::path regionDir = options.regionDir();
| ^~~~~~~~~~
main.cpp:54:22: error: ‘regionDir’ was not declared in this scope
54 | world.terrain.load(regionDir);
| ^~~~~~~~~
main.cpp:56:29: error: ‘struct Settings::WorldOptions’ has no member named ‘colorFile’
56 | if (!Colors::load(options.colorFile, world.terrain.cache, &colors))
| ^~~~~~~~~
main.cpp:68:28: error: ‘struct Settings::WorldOptions’ has no member named ‘outFile’
68 | PNG::Image image(options.outFile, canvas, colors);
| ^~~~~~~
<builtin>: recipe for target 'main' failed
make: *** [main] Error 1
spoutn1k commented
Somehow your compiler does not find std::filesystem at first glance. What is your compiler/os ?
It is a C++17 feature, so there is a minimum version requirement. On linux you can use gcc --version to get the version number.
Check if the -std=c++17 flag is present in the output of make; if it is, you may need to upgrade your compiler.
Fiuse commented
Was able to get it to work when updating gcc thanks for the help!