VS2013 Creating a opencv-2.4.10 static link library

Source: Internet
Author: User

When we borrow OpenCV function in VS2013, we often call OpenCV's library function in a dynamically linked way, so that it runs out of your computer to another computer (no OPENCV or OpenCV but the version is not the same as yours). This is not statically linked in a way!!!!!


Note the following is established after the system environment variable is configured.

Step 1: Right click on My Computer Select Properties in the click Advanced System settings in the Click environment variable

You create a new two variable in the user variable, such as the value of the variable as follows of course the path is your own



Note that the value of the system variable should be added later; A semicolon in English

You can start configuring the static link library later.

This afternoon spent half an afternoon to put their own computer well, the online tutorial is not clear, their own according to the original configuration more or less encountered problems:

1.Error 1 Error lnk2038:mismatch detected for ' _iterator_debug_level ': value ' 0 ' doesn ' t match value ' 2 ' in Bvpmeasure.obj

2, error LNK2019: unresolved external symbol [email protected], the symbol is referenced in the function _win32warninghandler

Error LNK2019: unresolved external symbol [email protected], this symbol is referenced in function [email protected]

There are a number of errors and workarounds under Category 1:

Step One: VS2013 menu Bar-"View Select Property Manager open the following interface on Microsoft.CPP.Win32.user right click on the select Properties, the additional dependencies to clear the original OPENCV link library


Here is the Add static library!!!!!



Several options for running the library: multi-threaded (/MT) static release multi-threaded debug (/MTD) static debug multi-threaded DLL (/MD) Dynamic release multi- Threaded Debug DLL (/MDD) Dynamic debug


Be sure to pay attention to the debug and relase under the best to change into a matching

There are a number of errors and workarounds under Category 2:

Step One:

add a header file yourself, and finally include it in the appropriate CPP, adding a header file to the #pragma comment (lib, "User32.lib")

If you still have an error adding //#pragma comment (lib, "Vfw32.lib")

#pragma comment (lib, "Comctl32.lib")//This two code I add after the error is not resolved, add #pragma comment (lib, "User32.lib") this solves the



In general, you only have to build your own file, including the following commands, almost.

#include <opencv2\core\core.hpp> #include <opencv2\highgui\highgui.hpp> #include <opencv2\core\ Core.hpp> #include <opencv2\highgui\highgui.hpp>//These dependent library files must be added,//Because these are third-party libraries used by OpenCV #pragma comment (lib , "IlmImfd.lib") #pragma comment (lib, "Libjasperd.lib") #pragma comment (lib, "Libjpegd.lib") #pragma comment (lib, " Libpngd.lib ") #pragma comment (lib," Libtiffd.lib ") #pragma comment (lib," Zlibd.lib ")//debug#ifdef _debug #pragma Comment (lib, "Opencv_calib3d2410d.lib") #pragma comment (lib, "Opencv_contrib2410d.lib") #pragma comment (lib, "opencv_ Core2410d.lib ") #pragma comment (lib," Opencv_features2d2410d.lib ") #pragma comment (lib," Opencv_flann2410d.lib ") # pragma comment (lib, "Opencv_gpu2410d.lib") #pragma comment (lib, "Opencv_highgui2410d.lib") #pragma comment (lib, "Openc V_imgproc2410d.lib ") #pragma comment (lib," Opencv_legacy2410d.lib ") #pragma comment (lib," Opencv_ml2410d.lib ") # pragma comment (lib, "Opencv_nonfree2410d.lib") #pragma comment (lib, "OpencV_objdetect2410d.lib ") #pragma comment (lib," Opencv_ocl2410d.lib ") #pragma comment (lib," Opencv_photo2410d.lib ") # pragma comment (lib, "Opencv_stitching2410d.lib") #pragma comment (lib, "Opencv_superres2410d.lib") #pragma comment (lib , "Opencv_ts2410d.lib") #pragma comment (lib, "Opencv_video2410d.lib") #pragma comment (lib, "Opencv_videostab2410d.lib  ") #else #pragma comment (lib," Opencv_calib3d2410.lib ") #pragma comment (lib," Opencv_contrib2410.lib ") #pragma comment ( LIB, "Opencv_core2410.lib") #pragma comment (lib, "Opencv_features2d2410.lib") #pragma comment (lib, "opencv_ Flann2410.lib ") #pragma comment (lib," Opencv_gpu2410.lib ") #pragma comment (lib," Opencv_highgui2410.lib ") #pragma Comment (lib, "Opencv_imgproc2410.lib") #pragma comment (lib, "Opencv_legacy2410.lib") #pragma comment (lib, "opencv_ Ml2410.lib ") #pragma comment (lib," Opencv_nonfree2410.lib ") #pragma comment (lib," Opencv_objdetect2410.lib ") #pragma Comment (lib, "Opencv_ocl2410.lib") #pragma comment (lib, "OpeNcv_photo2410.lib ") #pragma comment (lib," Opencv_stitching2410.lib ") #pragma comment (lib," Opencv_superres2410.lib ") #pragma comment (lib, "Opencv_ts2410.lib") #pragma comment (lib, "Opencv_video2410.lib") #pragma comment (lib, "Opencv_vi Deostab2410.lib ") #endif #pragma comment (lib," User32.lib ")//#pragma comment (lib," Vfw32.lib ")//#pragma comment (lib," Comctl32.lib ") using namespace CV;







Dir *2410.lib/on/b > Libddd.txt

VS2013 Creating a opencv-2.4.10 static link library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.