Skip to content

[BUG]: errors while trying to generate MinGW makefile with CMake on windows  #31

Open
@Blargian

Description

@Blargian

Describe you problem:

Windows users may need to use MinGW with CMake to compile the program. When generating a makefile for the sorting-visualizer using mingw32-make the following errors are thrown:

\sorting-visualizer\src\SortController.cpp: In member function 'void SortController::_startSort(int)':
\sorting-visualizer\src\SortController.cpp:144:71: error: no matching function for call to 'std::thread::thread(void (SortController::*)(), SortController*)'
  144 |         _animThread = std::thread(&SortController::checkSortAnim, this);
      |                                                                       ^
In file included from C:/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/thread:43,
                 from \sorting-visualizer\src\SortController.h:10,
                 from \sorting-visualizer\src\SortController.cpp:1:
C:/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
      |     ^~~~~~
C:/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/std_thread.h:156:5: note:   candidate expects 1 argument, 2 provided
C:/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;
      |     ^~~~~~
C:/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/std_thread.h:120:5: note:   candidate expects 0 arguments, 2 provided
\sorting-visualizer\src\SortController.cpp: In member function 'void SortController::startSort(int)':
\sorting-visualizer\src\SortController.cpp:165:81: error: no matching function for call to 'std::thread::thread(void (SortController::*)(int), SortController*, int&)'
  165 |         _sortingThread = std::thread(&SortController::_startSort, this, sortType);
      |                                                                                 ^
C:/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
      |     ^~~~~~
C:/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/std_thread.h:156:5: note:   candidate expects 1 argument, 3 provided
C:/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;
      |     ^~~~~~
C:/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/std_thread.h:120:5: note:   candidate expects 0 arguments, 3 provided
mingw32-make[2]: *** [CMakeFiles\sorting-visualizer.dir\build.make:121: CMakeFiles/sorting-visualizer.dir/src/SortController.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:82: CMakeFiles/sorting-visualizer.dir/all] Error 2
mingw32-make: *** [Makefile:90: all] Error 2

Steps to reproduce (optional):

  • clone the directory on windows using git clone https://github.com/alesbe/sorting-visualizer && cd sorting-visualizer
  • install CMake version 3.25.1
  • navigate to the root directory of the above cloned repository on local machine
  • Set up gcc and g++ compilers using (installation path may vary):

CMake -DCMAKE_C_COMPILER="C:/mingw64/bin/gcc.exe"
CMake DCMAKE_CXX_COMPILER="C:/mingw64/bin/g++.exe"

  • run CMake -G "MinGW Makefiles"
  • Build files get written to /sorting-visualizer
  • run mingw32-make
  • errors above occur at this point

Additional info (optional):

Running Windows 11
gcc.exe (x86_64-win32-sjlj-rev0, Built by MinGW-W64 project) 12.2.0
g++.exe (x86_64-win32-sjlj-rev0, Built by MinGW-W64 project) 12.2.0

OS

  • : Windows
  • : Mac OS
  • : Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageThis issue needs a manteiner revision

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions