use*_*328 2 c c++ linux opencv cuda
我过去曾在linux上使用opencv,但没有使用cuda.几个月来,我一直在努力解决以下编译错误.在尝试了许多解决方案后,我放弃了并使用了Windows.但是,我真的想在linux上工作.这是我用来编译opencv_gpu网站上给出的阈值示例的命令.
nvcc `pkg-config --libs opencv` -L. -L/usr/local/cuda/lib -lcuda -lcudart `pkg-config --cflags opencv` -I. -I/usr/local/cuda/include threshold.cpp -o threshold
Run Code Online (Sandbox Code Playgroud)
这是错误:
/tmp/tmpxft_0000171b_00000000-1_threshold.o: In function `main':
threshold.cpp:(.text+0x124): undefined reference to `cv::gpu::Stream::Null()'
threshold.cpp:(.text+0x156): undefined reference to `cv::gpu::threshold(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, double, double, int, cv::gpu::Stream&)'
threshold.cpp:(.text+0x16d): undefined reference to `cv::gpu::GpuMat::download(cv::Mat&) const'
/tmp/tmpxft_0000171b_00000000-1_threshold.o: In function `cv::gpu::GpuMat::GpuMat(cv::Mat const&)':
threshold.cpp:(.text._ZN2cv3gpu6GpuMatC1ERKNS_3MatE[cv::gpu::GpuMat::GpuMat(cv::Mat const&)]+0x63): undefined reference to `cv::gpu::GpuMat::upload(cv::Mat const&)'
/tmp/tmpxft_0000171b_00000000-1_threshold.o: In function `cv::gpu::GpuMat::~GpuMat()':
threshold.cpp:(.text._ZN2cv3gpu6GpuMatD1Ev[cv::gpu::GpuMat::~GpuMat()]+0xd): undefined reference to `cv::gpu::GpuMat::release()'
collect2: ld returned 1 exit status
make: *** [all] Error 1
Run Code Online (Sandbox Code Playgroud)
为了帮助您,我必须下载并安装CUDA 4.0(带驱动程序4.0.21),然后在Mac OS X 10.6.8上为我的Macbook Pro 下载和编译OpenCV 2.3.
OpenCV_GPU的示例代码已在我的机器上通过以下方式成功编译:
g++ threshold.cpp -o threshold `pkg-config --cflags --libs opencv` -lopencv_gpu
Run Code Online (Sandbox Code Playgroud)
您错过了标志-lopencv_gpu
,pkg-config不包含该标志.
归档时间: |
|
查看次数: |
9299 次 |
最近记录: |