I defined the following texture variable
texture<float, 2, cudaReadModeElementType> tex;
, but I did it inside a .cpp, so it compiled with visual studio’s cl.exe. The compiler complained that it didn’t recognize the type, and a small check revealed that the texture template is defined in cuda_texture_types.h, but is restricted to nvcc by
#if defined(__cplusplus) && defined(__CUDACC__)
, due to the host prefix for the member functions.
I was wondering if there’s a good reason for this, or maybe I could mess around with it, and define this structure in a .h without the host prefix?