Ask Your Question

How do I correctly add my own .cu files to the open CV poject?

asked 2013-06-12 07:58:40 -0500

VSR gravatar image

I have added my own .hpp, my own .cpp, and my own .cu files to the OpenCV project. I put the .hpp into the Include, the .cpp file into the host, and the .cu file into the "device" parts of the opencv_gpu module. The .hpp and the .cpp files complie fine. However it appears to me that my .cu file never gets compiled.

  1. When I compile OpenCV I get linker errors for the functions that are inside the .cu file.
  2. If I introduce blatant syntax errors to my .cu file the compiler never complains about them.
  3. When I go to the build menu when I have one of the .cu files that came with OpenCV opened, I get the option to "Build open_cv gpu". I get no such option when I try to do it when I have my .cu file open.

There must be a step that I am missing in order to get Visual studio to see my .cu file and invoke the compiler for it. Do I have to rerun Cmake, or edit some config file?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-06-12 11:45:03 -0500

Vladislav Vinogradov gravatar image

You should put your .cu file into modules/gpu/src/cuda directory and rerun CMake.

CMake will find this file and add it to project.

edit flag offensive delete link more

Question Tools


Asked: 2013-06-12 07:58:40 -0500

Seen: 196 times

Last updated: Jun 12 '13