Связывание Cuda в выпуске C ++

я искал существующие вопросы, но я не могуКажется, это решить.

У меня есть файл blur_mask.cc с:

#include 
#include 
#include 
#include 
#include 
#include 
#include 

extern "C" void gpuBlurMask(unsigned char* srcData, int srcStep, uchar3* dst, int dstStep, int width, int height, float *mask, int maskStep, int maskWidth, int maskHeight, int blockSize=16);

using namespace std;
using namespace cv;
using namespace cv::gpu;

void blurMask(Mat& src, Mat& dst, Mat& mask) {
    GpuMat gpuSrc, gpuDst, gpuMask;

    gpuSrc.upload(src);
    gpuDst.upload(dst);
    gpuMask.upload(mask);

    gpuBlurMask(gpuSrc.data, gpuSrc.step, gpuDst.ptr(), gpuDst.step, gpuSrc.cols, gpuSrc.rows, gpuMask.ptr(), gpuMask.step, gpuMask.cols, gpuMask.rows);

    gpuDst.download(dst);    
}
...

И файл gpu_blur.cu, который содержит

extern "C"
void gpuBlurMask(unsigned char* srcData, int srcStep, uchar3* dst, int dstStep, int width, int height, float *mask, int maskStep, int maskWidth, int maskHeight, int blockSize=16) {
...

Когда я делаю

nvcc -c -o gpu_blur gpu_blur.cu

Я не получаю ошибок, но при компиляции

g++ -o blur_mask blur_mask.cc gpu_blur -I /usr/local/cuda/include/ -lopencv_core -lopencv_highgui -lopencv_gpu

Я получаю следующие ошибки:

 g++ -o blur_mask blur_mask.cc gpu_blur -I /usr/local/cuda/include/ -lopencv_core -lopencv_highgui -lopencv_gpu -lcuda
gpu_blur: In function `gpuBlurMask':
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x59): undefined reference to `cudaMallocArray'
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0xa0): undefined reference to `cudaMemcpy2DToArray'
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x139): undefined reference to `cudaConfigureCall'
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x16f): undefined reference to `cudaDeviceSynchronize'
gpu_blur: In function `__cudaUnregisterBinaryUtil()':
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x184): undefined reference to `__cudaUnregisterFatBinary'
gpu_blur: In function `__device_stub__Z14blurMaskKernelP6uchar3iiiPfiii(uchar3*, int, int, int, float*, int, int, int)':
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x1b9): undefined reference to `cudaSetupArgument'
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x1dc): undefined reference to `cudaSetupArgument'
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x1ff): undefined reference to `cudaSetupArgument'
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x222): undefined reference to `cudaSetupArgument'
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x245): undefined reference to `cudaSetupArgument'
gpu_blur:tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x264): more undefined references to `cudaSetupArgument' follow
gpu_blur: In function `__nv_cudaEntityRegisterCallback(void**)':
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x381): undefined reference to `__cudaRegisterFunction'
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x3af): undefined reference to `__cudaRegisterTexture'
gpu_blur: In function `__sti____cudaRegisterAll_43_tmpxft_00000905_00000000_6_gpu_blur_cpp1_ii_srcTex()':
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text+0x3c3): undefined reference to `__cudaRegisterFatBinary'
gpu_blur: In function `cudaChannelFormatDesc cudaCreateChannelDesc()':
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text._Z21cudaCreateChannelDescIhE21cudaChannelFormatDescv[cudaChannelFormatDesc cudaCreateChannelDesc()]+0x34): undefined reference to `cudaCreateChannelDesc'
gpu_blur: In function `cudaError cudaBindTextureToArray(texture const&, cudaArray const*, cudaChannelFormatDesc const&)':
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text._Z22cudaBindTextureToArrayIhLi2EL19cudaTextureReadMode0EE9cudaErrorRK7textureIT_XT0_EXT1_EEPK9cudaArrayRK21cudaChannelFormatDesc[cudaError cudaBindTextureToArray(texture const&, cudaArray const*, cudaChannelFormatDesc const&)]+0x27): undefined reference to `cudaBindTextureToArray'
gpu_blur: In function `cudaError cudaLaunch(char*)':
tmpxft_00000905_00000000-3_gpu_blur.cudafe1.cpp:(.text._Z10cudaLaunchIcE9cudaErrorPT_[cudaError cudaLaunch(char*)]+0x14): undefined reference to `cudaLaunch'
collect2: ld returned 1 exit status

Спасибо.

Ответы на вопрос(1)

Ваш ответ на вопрос