0

Im trying to install the opencv libraries and i tried following the instructions at:
http://blog.cuvilib.com/2011/03/22/how-to-build-opencv-2-2-with-gpu-cuda-on-windows-7/
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()
{
	try
	{
		cout<<cv::gpu::getDeviceName(0);
	}
	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?

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by rubberman
0

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:
http://programmingexamples.net/index.php?title=OpenCV

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 :)

David

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.