Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
22 Views

error LNK2005: _log already defined in libmmt.lib(log_stub.obj)

I got this error message when building my DLL with static link to IPP and static link to OpenCV.

Pre-built library from OpenCV v2.4.0, build\\x86\\vc10\\staticlib\\opencv_core240d.lib Static link to parallel flavors of IPP v7.0.205 libs via _IPP_PARALLEL_STATIC macro. Static link to CRT (/MTd) in Visual Studio 2010. Got this error:

error LNK2005: _log already defined in libmmt.lib(log_stub.obj)

No error appears when linking against non-parallel IPP libs using _IPP_SEQUENTIAL_STATIC macro. I added libmmt.lib to /nodefaultlib linker option and error disappeared. By commenting out parts of my code I found out this error begins to appear when there is a call to the constructor of cv::Mat class in my code.

Since it is the default built of OpenCV libs without any support of IPP, I wonder, why I had this error.
0 Kudos
1 Reply
Highlighted
Employee
22 Views

Hello,

The problem happened likely because two math libraries were linked into the application. With adding the _IPP_PARALLEL_STATIC, the libmmt.lib library was implicitly included into linking line. While the static link to CRT (/MTd) in Visual Studio 2010 will also add the VS runtime libraries. The _log function are defined in both libraries, and report such error. It is right that you can use /nodefaultlib option to remove the problem.

Thanks,
Chao

0 Kudos