Ask Your Question

sbucc's profile - activity

2019-02-12 04:41:40 -0600 received badge  Student (source)
2018-11-01 04:59:08 -0600 received badge  Famous Question (source)
2017-08-16 02:23:07 -0600 received badge  Notable Question (source)
2017-04-07 10:06:00 -0600 received badge  Popular Question (source)
2015-08-08 03:12:24 -0600 commented question LNK1104: cannot open file 'python34_d.lib'

There is an ugly workaround, but there must be a better way. Anyway, the fix is to change the hardcoded DEFAULTLIB on line 325 of pyconfig.h to use the release lib. This is actually someone else's idea, but I can't find that post any more.

# if defined(_DEBUG)

//# pragma comment(lib,"python34_d.lib")

# pragma comment(lib,"python34.lib") // no debug lib in python distribution

# elif ...

It is also necessary to undefine Py_DEBUG on line 370 to avoid link errors:

#ifdef _DEBUG

//# define Py_DEBUG


2015-08-08 03:12:22 -0600 asked a question LNK1104: cannot open file 'python34_d.lib'

This happens on windows with VS 2015 doing a debug build of opencv 3.0 with python 3.4 bindings. The release build is ok (well, after removing the opencv_perf_core and opencv_test_core projects, but that is another bug mentioned elsewhere). The problem is that there is no such file in the python distribution, it only has the release version, python34.lib. However, I really don't see where python34_d.lib comes from: the settings for the linker in the opencv_python3 project, even for the debug build, have python34.lib. The only two places where I can see python34_d.lib are somewhere in the body of cv2.obj, as '/DEFAULTLIB:"python34_d.lib"', and in pyconfig.h, included (via python.h) in cv2.cpp, but frankly I would expect the linker directive to take precedence. Copying python34.lib to python34_d.lib doesn't help, which I find rather weird.

I understand that VS2015 is not yet officially supported (there are no binaries in the distribution), but at some points we surely want to add that support so I hope that this post will add something to that effort.