bindTexture() produces runtime error in fluidsGL CUDA example using VS2010

This example compiles with no warnings or errors but there are fatal errors when I actually run it.

I believe the relevant lines of code are:
setupTexture(DIM, DIM);
bindTexture();
The second line “bindTexture();” produces the error in the printout shown below:

C:\ProgramData\NVIDIA Corporation\CUDA Samples\v5.0\bin\win32\Release>fluidsgl
fluidsGL Starting…

[fluidsGL] - [OpenGL/CUDA simulation] starting…
OpenGL device is Available
CUDA device [GeForce 9800M GS] has 8 Multi-Processors
C:/ProgramData/NVIDIA Corporation/CUDA Samples/v5.0/5_Simulations/fluidsGL/fluid
sGL_kernels.cu(58) : getLastCudaError() CUDA error : cudaBindTexture failed : (1
8) invalid texture reference.

The only reference to this error I was able to find involved a direct call of cudaBindTexture() and they concluded that it worked as long as the texture was declared somewhere in the top level of the file instead of inside main().
(see cudaBindTexture failure - CUDA Programming and Performance - NVIDIA Developer Forums)

Any suggestions?
Dustin

p.s.: does anyone know where I can find documentation of functions like “bindTexture()”?

CUDA documentation is here:

[url]http://docs.nvidia.com/cuda/index.html[/url]

cudaBindTexture() in particular is documented here:

[url]CUDA Runtime API :: CUDA Toolkit Documentation

Search for cudaBindTexture on that paghe, I can’t figure out a way to generate a link to the particular section it is in (if anybody knows how to do that, please let me know). You might also want to check the Programming Guide.

I figured out where the relevant functions
setupTexture(DIM, DIM);
bindTexture();
are defined:
void setupTexture(int x, int y)
{
// Wrap mode appears to be the new default
texref.filterMode = cudaFilterModeLinear;
cudaChannelFormatDesc desc = cudaCreateChannelDesc();

cudaMallocArray(&array, &desc, y, x);
getLastCudaError("cudaMalloc failed");

}

void bindTexture(void)
{
cudaBindTextureToArray(texref, array);
getLastCudaError(“cudaBindTexture failed”);
}

Further searches have turned up lots of other people ALSO having this error with cudaBindTextureToArray(), but didn’t find any solutions yet.

Found the answer (after finding a post on stackoverflow that had a similar problem).
Evidently, the person who wrote that particular example didn’t think anyone would be using such an old version of CUDA. I just had to add “compute_11,code=sm_11” to the project’s and file’s list of compile options and it worked fine.