"texture is not a template " in MVS2012, CUDA 5.5


I got a problem in this line:

static texture<float, 2, cudaReadModeElementType> TexSrc;

As I searched in this forum, the header files are added:

#include “cuda_runtime.h”
#include “device_launch_parameters.h”

But still “texture is not a template”. And in the project, “tex2D is undefined”…

Thank you in advance for your help!

are you able to compile and run the cuda simpleTexture sample code?


If not, you probably have an improper CUDA install.

If so, you may have a project setup issue (e.g. have not selected CUDA Build Customization for your project)

I tried this sample project, the problem seems not caused by CUDA install…

When I tried to open vs2012 project, it said:

error : Unable to read the project file "simpleTexture_vs2012.vcxproj
The imported project “C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v110\BuildCustomizations\CUDA 6.0.props” was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

Then load is failed.

I think my cuda install is ok as I followed the instructions of the Nvidia instructions…

Maybe it is because of some other problems?

Your CUDA install is messed up. Did you install VS2012 after installing CUDA?

Yes…I installed VS2012…Why my CUDA install is messed up?

Now the sample project can be opened… The reason why I cannot open it is because the path in the file “simpleTexture_vs2012.vcxproj” is not correct.

But the problem still exists: “texture is not a template”.

Did you install CUDA and then VS2012?

Or did you install VS2012 and then CUDA?

First VS2012 then CUDA