Ask Your Question
0

Issue with build on symbols OpenCV 3.2.0 / VS2015 / Release (x64)

asked 2017-03-08 04:57:44 -0600

elliotwoods gravatar image

Hey all

I've been hitting a problem for a couple of days now of getting OpenCV to run within a project with VS2015 but am having library linking problems.

Specifically, I'm the maintainer of the ofxCvMin addon for openFrameworks, and am currently trying to upgrade the libraries from 2.4.x to 3.2.0. (I've built and linked opencv libs a few times for windows and osx over the years).

I can successfully build Debug and Release libs (this wasn't an issue at all). (note : current setup is static libs, not using static CRT)

I managed to build an application linking the debug libraries (with a little extra help on #opencv IRC), but Release is still is not working. VC++ doesn't seem to recognise the imported symbols.

Diggiging deeper, it seems that the C++ application is looking for :

?deallocate@Mat@cv@@QAEXXZ
public: void __thiscall cv::Mat::deallocate(void)

when building. But in opencv_core320.lib we have:

?deallocate@Mat@cv@@QEAAXXZ
public: void __cdecl cv::Mat::deallocate(void) __ptr64

which VC++ doesn't consider to be a compatible symbol. I presume there are some project settings which affect the symbol naming strategy (__thiscall <> __cdecl hints at a C++ vs C style).

Is anybody aware of project settings which affect how the symbols are decorated when using OpenCV with VC++?

Thank you

NB : CMAKE is not an option here as the projects/solutions need to be openFrameworks generated (although could be used to look into which build settings are present)

edit retag flag offensive close merge delete

Comments

also i posted the question on SO http://stackoverflow.com/questions/42... (i imagine more general C++ experience with name mangling there, and more experience with opencv building here :)

elliotwoods gravatar imageelliotwoods ( 2017-03-08 04:58:47 -0600 )edit

"NB : CMAKE is not an option here" -- ok, up to you, but that seems to be a useful hint, that we have to look at your build pipeline / makefile, whatever you use there. could you shed some light on this ?

berak gravatar imageberak ( 2017-03-08 05:56:59 -0600 )edit
1

can it be, your ofx project builds a 32bit binary ?

also, with static linking, oreder matters (opencv_core has to go behind anything, that references it)

berak gravatar imageberak ( 2017-03-08 06:05:18 -0600 )edit

hi berak. Thank you for helping on this! I now tried moving opencv_core320.lib to front and end of lib list but same result. definitely using all 64bit (checked dumpbin and all application project settings). I'll try CMAKE now as a sanity check + if it works i can compare project differences.

elliotwoods gravatar imageelliotwoods ( 2017-03-08 08:28:08 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-03-08 10:31:48 -0600

elliotwoods gravatar image

User berak was correct. This was a 32bit/64bit mismatch issue.

The bad setting wasn't in the project settings but in the Solution configuration (was set to use the 32bit version of the project for the 64bit build profile). I've seen that pop up a couple of times before but didn't recognise the symptoms.

Thanks to all on IRC and here for helping

Elliot

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-03-08 04:57:44 -0600

Seen: 784 times

Last updated: Mar 08 '17