Home > Back-end >  C thread gun4.8 use problem
C thread gun4.8 use problem

Time:09-25

Compile the problems encountered when using thread:
The static CascadeClassifier cascadeClassier;
Void faceDetect (Mat img, CascadeClassifier& Cascade, double scale, bool tryflip)
{... }
Void main {
Mat faceImage;
thread thread (faceDetect faceImage, cascadeClassier, 1.0, true);
T.d etach ();
}
Display an error
In the file included the from/usr/include/c + +/4.8/thread: 39:0,
The from SRC/QYFaceDetect. CPP: 7:
The/usr/include/c + +/4.8/functional: In instantiation of 'struct STD: : _Bind_simple & lt; Void (* (CV: : Mat, CV: : CascadeClassifier, double, Boolean)) (CV: : Mat, CV: : CascadeClassifier& , double, Boolean) & gt; ':
The/usr/include/c + +/4.8/thread: 137-47: required from 'STD: : thread: : thread (_Callable & amp; & , _Args & amp; & . ) [with _Callable=void (& amp;) (CV: : Mat, CV: : CascadeClassifier&, double, Boolean); _Args={CV: : Mat&, CV: : CascadeClassifier&, double, Boolean}] '
SRC/QYFaceDetect. CPP: 390-90: the required from here
The/usr/include/c + +/4.8/functional: 1697:61: error: no type named 'type' in 'class STD: : result_of & lt; Void (* (CV: : Mat, CV: : CascadeClassifier, double, Boolean)) (CV: : Mat, CV: : CascadeClassifier& , double, Boolean) & gt; '
Typedef typename result_of & lt; _Callable (_Args... ) & gt; : : type result_type;
^
The/usr/include/c + +/4.8/functional: 1727-9: error: no type named 'type' in 'class STD: : result_of & lt; Void (* (CV: : Mat, CV: : CascadeClassifier, double, Boolean)) (CV: : Mat, CV: : CascadeClassifier& , double, Boolean) & gt; '
_M_invoke (_Index_tuple & lt; _Indices...>)
^
Make: * * * [QYFaceDetect. O] Error 1


I this parameter in strict accordance with the function to, why will appear this problem, please answer,

CodePudding user response:

Cascade with ref

CodePudding user response:

reference 1st floor akirya response:
cascade with ref.


Cascade is a c + + class in this example, use ref can solve,
Why this example and post on http://bbs.csdn.net/topics/390800501 said the completely different,
According to the post said, 4.8 does not support the ref...

CodePudding user response:

refer to the second floor WB865365840 response:
Quote: refer to 1st floor akirya response:

Cascade with ref.


Cascade is a c + + class in this example, use ref can solve,
Why this example and post on http://bbs.csdn.net/topics/390800501 said the completely different,
According to the post said, 4.8 does not support the ref...

That is a member function and ref class object, realize the defect should be refers to this kind of situation,
  • Related