【问题标题】:"incorrect inclusion of a cudart header" error on CUDACUDA 上的“错误包含 cudart 标头”错误
【发布时间】:2013-04-16 11:03:30
【问题描述】:

对于数学运算,我添加到头文件中

#include <math_functions.h>
#include <device_functions.h>

但是当我编译它时,它开始出现以下错误。我该怎么办?

附言: CUDA 5.0,VS2010

NVIDIA GPU 计算工具包\CUDA\v5.0\include\crt/func_macro.h(50): 致命错误 C1189: #error : -- 错误包含 cudart 标头 文件

【问题讨论】:

  • 确保将这些标头包含在 cu 文件中,而不是 cpp 文件中。
  • 您永远不需要在用户代码中包含任何这些标头。

标签: cuda compiler-errors runtime-error


【解决方案1】:

您只需像这样用#define 和#undef 包装#include "math_functions.h":

#define __CUDA_INTERNAL_COMPILATION__
#include "math_functions.h"
#undef __CUDA_INTERNAL_COMPILATION__

而且似乎 math_functions.h 可能不包含在 .cpp 文件中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-24
    • 2015-03-23
    • 1970-01-01
    • 1970-01-01
    • 2015-01-22
    • 1970-01-01
    • 1970-01-01
    • 2013-01-04
    相关资源
    最近更新 更多