Member Avatar

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?

Re: Having trouble getting started with opencv 80 80

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

Re: Having trouble getting started with opencv 80 80

What dviddoria said, but also the GPU stuff requires 1) an nvidia card w/ CUDA capabilities, and 2) the nvidia CUDA development tools and libraries. This second issue is what may be causing your link failure. Anyway, here is the OpenCV GPU FAQ page which talks about what you need to do to use it: http://opencv.willowgarage.com/wiki/OpenCV%20GPU%20FAQ

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.