Im trying to install the opencv libraries and i tried following the instructions at:
but Im having problems getting the sample code to compile. When I try:

#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/gpu/gpu.hpp>

using namespace std;

int main()
	catch(const cv::Exception& ex)
		std::cout << "Error: " << ex.what() << endl;
	return 0;

I get these errors
1>test.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl cv::gpu::getDeviceName(int)" (?getDeviceName@gpu@cv@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) referenced in function _main

1>C:\Users\Chris\Documents\Visual Studio 2008\Projects\open cv image capture\Debug\open cv image capture.exe : fatal error LNK1120: 1 unresolved externals

How can I fix them?

Those are linker errors. You have not shown your compiler commands, but you'll need a -l something in there somewhere.

I have put several OpenCV examples here:

They all use CMakeLists.txt files to be used with the CMake build system, so unless you switch to CMake (which I highly recommend) the building part of the examples won't help you, but maybe the actual content will :)


Edited 4 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.