xelatihy / yocto-gl

Yocto/GL: Tiny C++ Libraries for Data-Driven Physically-based Graphics
https://xelatihy.github.io/yocto-gl
2.83k stars 207 forks source link

build error on ubuntu 22.04, gcc #1396

Closed podd0 closed 1 year ago

podd0 commented 1 year ago

I followed the instructions: "mkdir build; cd build; cmake ..; cmake --build ." and got this error.:

/home/andrea/yocto-gl/libs/yocto/yocto_sceneio.cpp: In lambda function:
/home/andrea/yocto-gl/libs/yocto/yocto_sceneio.cpp:228:25: error: ‘sleep_for’ is not a member of ‘std::this_thread’
  228 |       std::this_thread::sleep_for(std::chrono::milliseconds(context.delay));
      |                         ^~~~~~~~~
gmake[2]: *** [libs/yocto/CMakeFiles/yocto.dir/build.make:174: libs/yocto/CMakeFiles/yocto.dir/yocto_sceneio.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:510: libs/yocto/CMakeFiles/yocto.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

I looked up the error online and tried putting #define _GLIBCXX_USE_NANOSLEEP at the start of yocto_sceneio.cpp, but still got the same error

Metgraph commented 1 year ago

try to include thread library in yocto_sceneio.cpp

podd0 commented 1 year ago

it worked!

xelatihy commented 1 year ago

Ok, thanks. I'll push the fix on my end too.