SimpleHydrology
SimpleHydrology copied to clipboard
Compilation error
g++ -std=c++17 SimpleHydrology.cpp TinyEngine/include/imgui/imgui.cpp TinyEngine/include/imgui/imgui_demo.cpp TinyEngine/include/imgui/imgui_draw.cpp TinyEngine/include/imgui/imgui_widgets.cpp TinyEngine/include/imgui/imgui_impl_opengl3.cpp TinyEngine/include/imgui/imgui_impl_sdl.cpp -Wfatal-errors -O3 -I/usr/local/include -L/usr/local/lib -lnoise -lX11 -lpthread -lSDL2 -lnoise -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lGL -lGLEW -lboost_serialization -lboost_system -lboost_filesystem -o hydrology
In file included from SimpleHydrology.cpp:3:
source/world.h:208:46: error: non-local lambda expression cannot have a capture-default
208 | std::function<void(Model* m)> constructor = [&](Model* m){
| ^
compilation terminated due to -Wfatal-errors.
make: *** [makefile:11: all] Error 1
Is there anything I can do other than tweaking the source code?
This is a weird bug that keeps coming up. Because it once worked for me, I wonder if this is something that changed with compiler versions.
The direct fix is to simply remove the ampersand (just delete it from the brackets, i.e. [&] to []) where the error comes up.
I need to fix this with a pull request.
Thank you!