Ask Your Question
0

LNK1104: cannot open file 'python34_d.lib'

asked 2015-08-07 16:17:20 -0600

sbucc gravatar image

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.

edit retag flag offensive close merge delete

Comments

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

#endif

sbucc gravatar imagesbucc ( 2015-08-07 18:06:42 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-01-06 11:37:13 -0600

lorv83 gravatar image

I suggest changing the Solution Configuration from Debug to Release - this should solve the problem (at least the new versions have appropriate conditional statements in pyconfig.h).

edit flag offensive delete link more

Comments

Thanks lorv83

Amol gravatar imageAmol ( 2020-06-23 01:42:56 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-08-07 16:17:20 -0600

Seen: 12,849 times

Last updated: Aug 07 '15