Failed to build cpp_package on Windows



tried to build the cpp_package but it fails:

1>------ Build started: Project: cpp_package_op_h, Configuration: Release x64 ------
1>Traceback (most recent call last):
1> File “”, line 429, in
1> raise(e)
1> File “”, line 423, in
1> f.write(patternStr % ParseAllOps())
1> File “”, line 318, in ParseAllOps
1> cdll.libmxnet = cdll.LoadLibrary(sys.argv[1])
1> File “C:\Program Files\Anaconda3\lib\”, line 422, in LoadLibrary
1> return self.dlltype(name)
1> File "C:\Program Files\Anaconda3\lib\ctypes_init
.py", line 344, in init
1> self._handle = _dlopen(self._name, mode)
1>OSError: [WinError 126] The specified module could not be found
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: “cmd.exe” exited with code 1.
1>Done building project “cpp_package_op_h.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========

MXNET builds in release and debug mode, but the cpp_package fails on the opwrapper to generate the op.h include file. I have put a print statement in, to see which file is in the command line, but that seems OK.

System: Windows 10 Pro X64
MXNet 1.3.0
Visual Studio 17 professional, using toolset v14.16
OpenCV 3.4.4
CMake 3.12.4
Anaconda3 64 bit

Looking for a solution


Found the solution by setting the OpenCV release dir to the PATH. Now it generates the OpWrapper.h include file.

But compiling the examples breaks because mxnet_static.lib not found by the linker.

This problem can be solved by changing the mxnet_static.lib library reference to (SolutionDir)(Configuration)\libmxnet.lib in the linker properties of the example project files (need to do that for every example).