Loris Fichera
Loris Fichera

Reputation: 98

cuda Texture declaration compile-time error

I'm trying to compile the following piece of code:

#include <stdio.h>
#include <time.h>
#include <cuda.h>
#include <cuda_runtime_api.h>

texture<float, 2, cudaReadModeElementType> tex;

int main () { ... }

yet, nvcc gives me the following error:

main.c:6:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token

I'm pretty new to CUDA, so I suppose I'm missing something here.

Upvotes: 2

Views: 1837

Answers (1)

Brian Cain
Brian Cain

Reputation: 14619

You can only use CUDA syntax in .cu files.

Upvotes: 4

Related Questions