Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 cuda c 中将“const void*”分配给“const uint64_t*”。
我做过这样的,
void func(const void *buffer) { const uint64_t *words = buffer; }
但我收到这样的错误,
错误:“const void *”类型的值不能用于初始化“const uint64_t *”类型的实体
谁能帮我解决这个问题?
正如@sharptooth 所指出的,这为我修复了它:
#include <stdio.h> #include <stdint.h> void func(const void *buffer) { const uint64_t *words = (const uint64_t *) buffer; } int main(){ void *my_buf=0; func(my_buf); return 0; }