Ask Your Question

#include <mutex> error with CLR compilation with opencv-4.0.0-alpha-vc14_vc15.exe

asked 2018-10-03 03:51:11 -0500

stran gravatar image

updated 2018-10-03 04:41:25 -0500

Dears all,

I just want to make a report: When developping application with opencv-4.0.0-alpha-vc14_vc15.exe there is an error of compilation with VC2017.

"E0035 directive #error : <mutex> is not supported when compiling with /clr or /clr:pure. C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include\mutex 8"

By investigating: only the header file "utility.hpp" use "#include < mutex >" line 61. How could fixe this issue?

With the opencv realease 343, there is no this error. It means "utility.hpp" in this realease didn't use #include <mutex>.

Thank a lot for help in the future to maintain the possibility to developp Opencv application under VC with CLR.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2018-10-03 04:09:09 -0500

berak gravatar image

updated 2018-10-03 04:27:37 -0500

there already exist a couple of similar issues

though there are attempts to mend it -- in the end it's a "won't fix".

if you want my 2ct. here: avoid clr / managed code. opencv uses a RAII based programming model, 4.0 will heavily use c++11 features, all of it incompatible to managed c++. (the mutex problem is only the tip of the iceberg, you can't have a cv::Mat or a Ptr as a classmember, but need pointers to those (defeating the purpose of refcounting))

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-10-03 03:51:11 -0500

Seen: 247 times

Last updated: Oct 03 '18