Each time you download a new version of OPENCV, you need to re-write the header file, change the link library configuration, it is troublesome to have wood? Below this header file is I in someone else's code to Amoy out, very good, share with you ~ (the specific author forgot, sorry AH)
The author has cleverly used OPENCV version information to define a macro, whether your OPENCV is 243 or 246 can be perfect support, no longer worry about the updated version of the problem, another: for the older version of OPENCV may have the name of the individual Lib is not correct, modify it can be
StdAfx.h
#pragma once#include "targetver.h" #include <stdio.h> #include <tchar.h> #include <iostream># Include <fstream> #include <opencv2/opencv.hpp> #define CV_VERSION_ID cvaux_str (cv_major_version) cvaux_s TR (cv_minor_version) cvaux_str (cv_subminor_version) #ifdef _debug#define cvlib (name) "OPENCV_" name cv_version_id "D" # Else#define cvlib (name) "OPENCV_" name Cv_version_id#endif#pragma comment (lib, cvlib ("core")) #pragma comment (lib, Cvli B ("Imgproc")) #pragma comment (lib, cvlib ("Highgui")) #pragma comment (lib, cvlib ("Flann")) #pragma comment (lib, cvlib ("F Eatures2d ")) #pragma comment (lib, cvlib (" calib3d ")) #pragma comment (lib, cvlib (" GPU ")) #pragma comment (lib, cvlib (" Lega Cy ")) #pragma comment (lib, cvlib (" ml ")) #pragma comment (lib, cvlib (" Objdetect ")) #pragma comment (lib, cvlib (" ts ")) #pra GMA Comment (Lib, cvlib ("video")) #pragma comment (lib, cvlib ("contrib")) #pragma comment (lib, cvlib ("nonfree"))
Source Address: http://www.cnblogs.com/easymind223/p/3308279.html
OpenCV various versions of the Universal header file