我正在使用 nvcc 来编译 CUDA 内核。不幸的是,nvcc 似乎不支持 uint8_t
,虽然它确实支持 int8_t
(!)。我会尽快不使用 unsigned char
,出于便携性、可读性和理智的原因。还有其他好的选择吗?
为了防止任何可能的误解,这里有一些细节。
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2010 NVIDIA Corporation
Built on Mon_Jun__7_18:56:31_PDT_2010
Cuda compilation tools, release 3.1, V0.2.1221
代码包含
int8_t test = 0;
很好,但代码包含
uint8_t test = 0;
抛出一条错误消息,如
test.cu(8): error: identifier "uint8_t" is undefined
最佳答案
C99 整数类型不是“由编译器定义的”——它们在 <stdint.h>
中定义.
尝试:
#include <stdint.h>
关于compiler-construction - 当编译器不提供 uint8_t 时,有什么好的替代方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4189243/