"Texture is not a template"


I’ve got a problem with creating textures. CUDA SDK works fine moreless, but this line

texture<float, 2, cudaReadModeElementType> TexSrc;

is giving me an error such as in topic title.
I’ve got GeForce GTX 1070 graphics card running on CUDA 8.0 SDK.

Any idea, how to fix it?

Thanks in advance,

Ok, after further investigation, I’ve found the definition of texture template in cuda_texture_types.h but the structure is under condition “#if defined(__cplusplus) && !defined(CUDACC)” which is always false. Does anybody have a clue how to to make it work? What is CUDACC - because this macro makes the whole sentece false?

Is this on windows or linux? If it is on windows, is this an intellisense error or an actual compile-time error?

Are you able to build the CUDA sample projects (as-is) that contain such texture references?

CUDACC is defined in the nvcc manual:


You might just want to google “cuda texture is not a template” I think you’ll find lots of useful information.
If you want more discussion about CUDACC try googling it.