This is my code in Visual Studio C++
#include \"stdafx.h\"
#include
#include
using namespace cv;
int main(int
'unresolved external symbol'
means that you're not linking with required library.
Go to Properties -> Linker -> Additional Library dependencies
and add path to OpenCV libs.
First check How to build applications with OpenCV inside the Microsoft Visual Studio
If you still suffer from the same problem, you could be under one of the below cases.
If you are under one of these cases, check Compiling a 64-bit Application in Microsoft Visual Studio Express 2010
i searched a lot for the same problem this was the best solution i had found and it worked for me.
Open Configuration Properties > C/C++ > General, and edit the field Additional Include Directories to add these 3 paths (for the headers):
C:\OpenCV2.3\build\include\opencv
C:\OpenCV2.3\build\include\opencv2
C:\OpenCV2.3\build\include
Add these into your code:
#pragma comment (lib, "opencv_core248d.lib")
#pragma comment (lib, "opencv_highgui248d.lib")
#pragma comment (lib, "opencv_imgproc248d.lib")
#pragma comment (lib, "opencv_video248d.lib")
#pragma comment (lib, "opencv_features2d248d.lib")
It worked for me.