Here are the steps I’ve taken to try and create an executable in VS 2019 w/the OpenCV classifier example. note… I added the classifier code as a function into an existing MFC app.
Just to ensure I had no conflicts I created a new drive with a fresh copy of Win 10.
Installed VS2019, cpython 3.7, cmake 3.19, opencv-4.51-vc14_vc15, opencv_contrib-4.4.1
Using cmake I created a build directory, ran configure and generate. no errors
4.Located the ALL_BUILD.vcxproj to build the CV libraries for release and debug. Had no errors. Libraries such as opencv_dnn451d.lib, opencv_core451d.lib showed up in my …build\lib\debug directory.
5.Used pcbuild.proj to to build cpython libraries. (I use this in another part of my app)
Opened an existing x64 MFC app that pulls images from multiple cameras and added a function I named classifier that contained the code verbatim from the opencv classifier example.
Modified my library locations to point to the new library files. Configuration manager-Linker-Input-Additional Dependencies-opencv_dnn451d.lib…etc.
Program compiles but fails to link. I will get 25 link errors if I include none of the newly created libraries, only 9 errors associated with dnn with error LNK2001: unresolved external symbol “public: __cdecl cv::dnn::dnn4_v20181221::Net::~Net(void)” (??1Net@dnn4_v20181221@dnn@cv@@QEAA@XZ) being the first one.
Not being sure which specific library was needed for the Net:: function I pointed to all 49. I think I required only core, highgui, dnn, vidioio an imgproc.