Linking "cuda_runtime_api.h" gives error: "expected initializer before 'cudaGetFuncBySymbol'"

Hi,

This is my first question on this forum, so if i don’t give enough info please let me know!

OS: Ubuntu 20.04
cuda version: 11.5
opencv version: 4.5.3

I’m programming a c++ application on eclipse using opencv and cuda.
As I want to implement a watershed function into the program I was looking into using NPP, because running watershed over the cpu is too slow for the application. But when I include npp.h into my program I get the error: /usr/local/cuda-11.5/targets/x86_64-linux/include/cuda_runtime_api.h:12665:45: error: expected initializer before ‘cudaGetFuncBySymbol’.

the line in cuda_runtime_api.h which gives the error is:

I searched the internet but could not find any other problems like this one, I did find that the function cudaGetFuncBySymbol is not supported in cuda 11.5 for python (CUDA Python 11.5.0 Release notes - CUDA Python 11.7.1 documentation).

Does anybody know how to fix this problem?
Thanks!

Some possible reasons for this include:

  1. a corrupted cuda install (mixing cuda versions)
  2. attemptng to use incorrect/incompatible host compiler
  3. incorrect usage of C++ switches like -std=c++11 or similar

Okay, so I fixed it by removing “-I/usr/local/cuda-11.5/targets/x86_64-linux/include” include path.
Instead I created my own file called lib inside my project and copy pasted the contents of “/usr/local/cuda-11.5/targets/x86_64-linux/include” to the new lib-file.
I had to change a few include paths inside the header files, but now the libraries work!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.