Compiling a basic OpenCV + Cuda program on linux

前端 未结 3 1668
后悔当初
后悔当初 2021-01-07 03:55

I\'ve worked with opencv on linux in the past, but not with cuda. I\'ve struggled with the following compilation error for months. And after trying many solutions i gave up

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-07 04:21

    This looks like a linker problem. I don't know, if nvcc follows the same conventions as gcc, but I would try:

    nvcc `pkg-config --cflags opencv` -L. -L/usr/local/cuda/lib -I. -I/usr/local/cuda/include -o threshold threshold.cpp `pkg-config --libs opencv` -lcuda -lcudart

    More in general: If you write

    gcc t.cpp -lB -lA

    it means that libB depends on symbols from libA; t.cpp can depend on symbols from libA and libB.

提交回复
热议问题