【发布时间】:2013-02-18 18:30:44
【问题描述】:
我有以下文件:
// Main.cpp
#include "kernel_util.cuh"
int main()
{
call_kernel();
}
// kernel_util.cuh
#ifndef KERNEL_UTIL
#define KERNEL_UTIL
#include <cuda_runtime.h>
void call_kernel();
#endif
// kernel_util.cu
#include "kernel_util.cuh"
#include "kernel.curnel"
#define thread 16
void call_kernel() {
dim3 blocks( ( width + thread - 1 ) / thread, ( height + thread - 1 ) / thread );
dim3 threads( thread, thread );
kernel<<<blocks, threads>>>();
}
// kernel.curnel
#ifndef KERNEL
#define KERNEL
#include <cuda_runtime.h>
__global__ void kernel() {
}
#endif
我安装了带有 64 位编译器和 CUDA 5.0 工具包的 Visual Studio 2010。上面的代码编译成功但是行
kernel<<<blocks, threads>>>();
3rd < 给出“expected an expression”错误,但代码编译没有问题并到达内核函数。
配置属性:
- cpp 文件项类型 c/c++ 编译器
- cu 文件项类型 cuda c/c++
- cuh 文件项类型不参与构建
- curnel 文件项类型不参与构建
【问题讨论】:
-
我认为问题出现在 Intellisense 中?
-
你这是什么意思。你能说得更具体点吗??
-
你从哪里得到错误?显然不是在编译时,正如你所说的代码编译干净。因此,唯一可能出现错误的其他区域是 VS 中的后台语法检查,即 Intellisense。
标签: c++ visual-studio syntax cuda