Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ visual studio.cu文件显示语法错误,但编译成功_C++_Visual Studio_Syntax_Cuda - Fatal编程技术网

C++ visual studio.cu文件显示语法错误,但编译成功

C++ visual studio.cu文件显示语法错误,但编译成功,c++,visual-studio,syntax,cuda,C++,Visual Studio,Syntax,Cuda,我有以下文件: // 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"

我有以下文件:

// 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
//Main.cpp
#包括“kernel_util.cuh”
int main()
{
调用_内核();
}
//kernel_util.cuh
#ifndef内核
#定义内核
#包括
void调用_内核();
#恩迪夫
//kernel_util.cu
#包括“kernel_util.cuh”
#包括“kernel.curnel”
#定义线程16
void call_kernel(){
dim3块((宽度+螺纹-1)/螺纹,(高度+螺纹-1)/螺纹);
dim3螺纹(螺纹,螺纹);
内核();
}
//kernel.curnel
#ifndef内核
#定义内核
#包括
__全局无效内核(){
}
#恩迪夫
我安装了带有64位编译器和CUDA 5.0工具包的Visual Studio 2010。上面的代码编译成功,但行

kernel<<<blocks, threads>>>();
kernel();
3rd
IDE(MSVC++)及其用于IntelliSense的编译器前端(自动完成建议和“错误”代码下的红线)对CUDA及其特殊语法一无所知。对于大多数CUDA代码,VS有一些方法,但是CUDA中的块/线程的选择<代码> >代码>是非常不幸的,C++编译器前端无法理解(至少,它需要对分析器进行非常广泛的修改)。

总而言之,你必须忍受下面的红色曲线

我想问题是在Intellisense中出现的?你这是什么意思。你能说得更具体些吗?你从哪里得到的错误?显然不是在编译时,正如您所说,代码编译得很干净。因此,出现错误的唯一其他区域是VS中的后台语法检查,也称为Intellisense。可能与我找到的另一个答案重复