Failed project settings in VS13. Syntax error: Surface and texture

Dear Reader,

I am trying to test some code that has recently passed into my responsibilities. While the CUDA projects passed onto me work, I can’t seem to get a [new Project] inside the VS13 [Solution] to work.

I’ve created a CUDA 6.5 runtime project. I’ve also added the dependencies needed for my own code.
Upon compiling, I receive several [error C2061: Syntax error : Identifier ‘surface’] or ‘texture’.

I’m currently at a loss as to what I am missing. I would guess there is some dependency I need to add to the project, but it is hard to find any relevant resources online when looking for this error message. I’ve already added “compute_30,sm_30” in the correct place (i.e. the same place as in the projects that compile).

My sincere thanks,

what is the name of the file you are compiling when you get the syntax error on surface ?

The file is cudaList.h, and works in the other Projects.


void bind(texture<T, cudaTextureType2D, cudaReadModeElementType>& texref){ ... }

What files are you including cudaList.h in ?

Are you including cudaList.h in any .cpp files?

cudaList.h is included in both tracker.h and, and contains a #pragma once instruction.

tracker.h is included in main.cpp, which is the application.

You cannot include that stuff in main.cpp

That is the source of your problem.

things like “texture” and “surface” keywords are CUDA-specific.
THey must be compiled by the nvcc compiler to be understood. In a VS project, things that are included in a .cu file will be compiled by nvcc. Things that are included in a .cpp file will be compiled by cl.exe, the ordinary VS host code compiler. This compiler does not understand “surface” and “texture”, and throws syntax errors.

You cannot include these things in a .cpp file. They must only appear (via include or otherwise) in .cu files, in a VS CUDA project.