cuda纹理声明编译时错误

时间:2012-10-25 14:21:56

标签: cuda textures

我正在尝试编译以下代码:

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

texture<float, 2, cudaReadModeElementType> tex;

int main () { ... }

然而,nvcc给了我以下错误:

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

我对CUDA很新,所以我想我在这里遗漏了一些东西。

1 个答案:

答案 0 :(得分:4)

您只能在.cu文件中使用CUDA语法。

相关问题