I have successfully downloaded OpenCV source, configured CMake, and generated build files for Visual Studio 2019/Windows 10. I load the solution without any issue and the build proceeds without any issue. However, when the build finishes I find one error saying that the debug version of python39_d.lib was not found.
I don’t need python for what I am doing. CMake detected it and added it to the configuration. I see in the OpenCV source code at pyconfig.h the following code:
/* For an MSVC DLL, we can nominate the .lib files used by extensions */
#ifdef MS_COREDLL
if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
/* not building the core - must be an ext */
if defined(_MSC_VER)
/* So MSVC users need not specify the .lib
file in their Makefile (other compilers are
generally taken care of by distutils.) */
if defined(_DEBUG)
pragma comment(lib,“python39_d.lib”)
elif defined(Py_LIMITED_API)
pragma comment(lib,“python3.lib”)
else
pragma comment(lib,“python39.lib”)
endif /* _DEBUG */
endif /* _MSC_VER */
endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */
It appears that this is the only place that python39_d.lib is referenced.
Can I safely ignore this error? Is there a preferred approach to linking with the non-debug version of the library? As I say, I don’t need python for what I am doing because I am working in C++.
Thank you for any insights.