I have a c++ windows form application that I would like to use dlib with. I have opencv working fine, capturing video, etc. I have installed the latest dlib off github and added the library directories to properties in the project in VS 2015. Simply adding dlib source.cpp to my project generates errors about <condition_variable>, <future>, <mutex> and <thread> not being supported in /clr or /clr:pure. If I turn off /clr support for source.cpp, my project will again compile but immediately crashes with excpetions in ntdll.dll - access violations. Removing source.cpp returns the project to a happy working state. Anyone have experience with mixing CLR and dlib as I haven't run into this problem with opencv and I've struggled to find anything super clear/relevant on google. Thanks so much in advance for any help/guidance.
Cheers!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
dlib is just C++ code. There isn't anything special in it that would
prevent it from working in a C++ compiler. So are you sure you are
compiling all the .cpp files with the same compiler settings? Generally
speaking, in C++, you have to compile all the .cpp files in the same mode
or you get what are called one definition rule errors. This isn't a dlib
thing but is a core C++ language thing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey Davis,
Even I am getting the same error,. I have used openCV and it's working fine, but when ever I am using the dlib in my header file and getting same error as mentioned by Dane :
"about <conditionvariable>, <future>, <mutex> and <thread> not being supported in /clr or /clr:pure."</thread></mutex></future></conditionvariable>
Can you please suggest some way to get rid of these errors :)
@davisking
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the speedy reply. This was my understanding as well. In past projects, simply setting the file to not include /clr support was sufficient - the project would compile correctly and run correctly. What I can't understand is that I'm not even using any dlib calls yet, just including them via source.cpp in the project. And compiling and linking completes correctly when disabling /clr for the file, but upon launching the application I get an immeidate crash/exception - ntdll.dll from utility.cpp. I was hoping maybe someone in the community has some experience getting dlib to work within managed c++ / clr application / mixed enironment. I'm definitely not a compiler/linker expert, but currently something feels incompatible.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No idea. My experience with managed C++ is that it is a nightmare of
incompatibilities with ISO standard C++. In the past I have used swig to
create C# interfaces to C++ and that works well since you can use a real
C++ compiler to compile the C++ code into a dll, which is then used in C#.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Davis,
I have used the PInvoke method , and i wanted to get the image_window to be accessed in the c# project or is there any way to get all the data related to
(
std::vector<dlib::rectangle> dets = detector(img);
std::vector<full_object_detection> shapes;
) to c# project?</full_object_detection></dlib::rectangle>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a c++ windows form application that I would like to use dlib with. I have opencv working fine, capturing video, etc. I have installed the latest dlib off github and added the library directories to properties in the project in VS 2015. Simply adding dlib source.cpp to my project generates errors about <condition_variable>, <future>, <mutex> and <thread> not being supported in /clr or /clr:pure. If I turn off /clr support for source.cpp, my project will again compile but immediately crashes with excpetions in ntdll.dll - access violations. Removing source.cpp returns the project to a happy working state. Anyone have experience with mixing CLR and dlib as I haven't run into this problem with opencv and I've struggled to find anything super clear/relevant on google. Thanks so much in advance for any help/guidance.
Cheers!
dlib is just C++ code. There isn't anything special in it that would
prevent it from working in a C++ compiler. So are you sure you are
compiling all the .cpp files with the same compiler settings? Generally
speaking, in C++, you have to compile all the .cpp files in the same mode
or you get what are called one definition rule errors. This isn't a dlib
thing but is a core C++ language thing.
Hey Davis,
Even I am getting the same error,. I have used openCV and it's working fine, but when ever I am using the dlib in my header file and getting same error as mentioned by Dane :
"about <conditionvariable>, <future>, <mutex> and <thread> not being supported in /clr or /clr:pure."</thread></mutex></future></conditionvariable>
Can you please suggest some way to get rid of these errors :)
@davisking
Thanks for the speedy reply. This was my understanding as well. In past projects, simply setting the file to not include /clr support was sufficient - the project would compile correctly and run correctly. What I can't understand is that I'm not even using any dlib calls yet, just including them via source.cpp in the project. And compiling and linking completes correctly when disabling /clr for the file, but upon launching the application I get an immeidate crash/exception - ntdll.dll from utility.cpp. I was hoping maybe someone in the community has some experience getting dlib to work within managed c++ / clr application / mixed enironment. I'm definitely not a compiler/linker expert, but currently something feels incompatible.
No idea. My experience with managed C++ is that it is a nightmare of
incompatibilities with ISO standard C++. In the past I have used swig to
create C# interfaces to C++ and that works well since you can use a real
C++ compiler to compile the C++ code into a dll, which is then used in C#.
Hi Davis,
I have used the PInvoke method , and i wanted to get the image_window to be accessed in the c# project or is there any way to get all the data related to
(
std::vector<dlib::rectangle> dets = detector(img);
std::vector<full_object_detection> shapes;
) to c# project?</full_object_detection></dlib::rectangle>