smasherprog / screen_capture_lite

cross platform screen/window capturing library
MIT License
616 stars 156 forks source link

How to build for MinGW #152

Closed SAOMDVN closed 1 year ago

SAOMDVN commented 1 year ago

Hi, I'm sorry for troubling you but I need help with building for MinGW. I tried cmake -G "MinGW Makefiles" . and then make but it seems that there's some incompabilities:

D:\Download\screen_capture_lite-master\src_cpp\ScreenCapture.cpp: In member function 'void SL::Screen_Capture::ScreenCaptureManager::start()':
D:\Download\screen_capture_lite-master\src_cpp\ScreenCapture.cpp:128:10: error: no matching function for call to 'std::thread::thread(SL::Screen_Capture::ScreenCaptureManager::start()::<lambda()>)'
  128 |         });
      |          ^
In file included from D:/MinGW64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/thread:43,
                 from D:/Download/screen_capture_lite-master/include/ScreenCapture.h:23,
                 from D:\Download\screen_capture_lite-master\src_cpp\ScreenCapture.cpp:1:
D:/MinGW64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/std_thread.h:156:5: note: candidate: 'std::thread::thread(std::thread&&)'
  156 |     thread(thread&& __t) noexcept
      |     ^~~~~~
D:/MinGW64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/std_thread.h:156:21: note:   no known conversion for argument 1 from 'SL::Screen_Capture::ScreenCaptureManager::start()::<lambda()>' to 'std::thread&&'
  156 |     thread(thread&& __t) noexcept
      |            ~~~~~~~~~^~~
D:/MinGW64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/std_thread.h:120:5: note: candidate: 'std::thread::thread()'
  120 |     thread() noexcept = default;
      |     ^~~~~~
D:/MinGW64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/std_thread.h:120:5: note:   candidate expects 0 arguments, 1 provided
make[2]: *** [src_cpp\CMakeFiles\screen_capture_lite_shared.dir\build.make:91: src_cpp/CMakeFiles/screen_capture_lite_shared.dir/ScreenCapture.cpp.obj] Error 1
make[1]: *** [CMakeFiles\Makefile2:246: src_cpp/CMakeFiles/screen_capture_lite_shared.dir/all] Error 2
make: *** [Makefile:145: all] Error 2

Thank you in advacne

smasherprog commented 1 year ago

i dont build for mingw. If you find issues and can issue some PR's im glad to merge them in!

SAOMDVN commented 1 year ago

I reinstall my MinGW compiler from using win32 thread to posix thread and it compiled.