how to add .cu file to OPENCV source without obtain linked error

asked 2014-05-13 05:02:23 -0600

aurelien gravatar image

Hi everybody. I would like to know how to add .cu file to the OPENCV source. To test a CUDA function, I have written a simple function who adds a value to all pixels of matrix. But when I compile the project, I obtain link error. I follow the same scheme as for pyrup functions: - Templates functions in .cu file - I create the declaration of the host function in the gpu.hpp file and I create a .cpp file in which I define the host function (which called the CUDA function). If I put my function in original sources files (pyr_up.cu , gpu.hpp, pyramids.cpp), I can build the solution and access to the function, but not if I create new files… I’ve got one error by each type of data, they all looks like to : Erreur 101 error LNK2001: symbole externe non résolu "void __cdecl cv::gpu::device::imgproc::test_gpu<float>(struct cv::gpu::DevMem2D_<unsigned char="">,struct cv::gpu::DevMem2D_<unsigned char="">,struct CUstream_st *)" (??$test_gpu@M@imgproc@device@gpu@cv@@YAXU?$DevMem2D_@E@23@0PAUCUstream_st@@@Z) F:\install_opencv_cuda_modif\modules\gpu\testCuda.obj

edit retag flag offensive close merge delete

Comments

1

Why not create your library and do not add your code to opencv source code. If opencv changes version, you must add again.

wuling gravatar imagewuling ( 2014-05-13 09:43:23 -0600 )edit