0

All the solutions I got for such an error had function where variables were passed by reference. What if i pass the variable by value and still get the error. This is my code

these are public global variables in MyProcess class

int n,gt,rt;
string paths[10];
std::thread t[10];

this is the function where I am making multiple threads.

void MyProcess::start(){
   int j;
   for (int i = 0; i < n; i++){
       j=i+1;
       t[i] =std::thread(processVideo, paths[i], j, gt, rt);
   }
   for (int i = 0; i < n; i++)
       t[i].join();
}

this is the definition of the function i am calling in the thread

void MyProcess::processVideo(string videoFilename, int pos, int gt, int rt){}

Error I am getting is this

C:\Qt\Tools\mingw530_32\i686-w64-mingw32\include\c++\functional:1426: error: static assertion failed: Wrong number of arguments for pointer-to-member
       static_assert(_Varargs::value
       ^
C:\Qt\Tools\mingw530_32\i686-w64-mingw32\include\c++\functional:1505: error: no type named 'type' in 'class std::result_of<std::_Mem_fn<void (MyProcess::*)(std::__cxx11::basic_string<char>, int, int, int)>(std::__cxx11::basic_string<char>, int, int, int)>'
       typedef typename result_of<_Callable(_Args...)>::type result_type;
                                                             ^
C:\Qt\Tools\mingw530_32\i686-w64-mingw32\include\c++\functional:1526: error: no type named 'type' in 'class std::result_of<std::_Mem_fn<void (MyProcess::*)(std::__cxx11::basic_string<char>, int, int, int)>(std::__cxx11::basic_string<char>, int, int, int)>'
         _M_invoke(_Index_tuple<_Indices...>)
         ^

Thanks in advance.

m7913d
  • 10,244
  • 7
  • 28
  • 56

0 Answers0