2014-05-24 208 views
1

當我嘗試編譯我的程序首先我得到這個錯誤:錯誤:矛盾的聲明uint32_t的

error: ‘uint32_t’ does not name a type

然後我包括

#include <stdint.h> 

現在變成了這個錯誤:

/include/stdint.h:52: error: conflicting declaration ‘typedef unsigned int uint32_t’

/cuda/include/vector_types.h:452: error: ‘uint32_t’ has a previous declaration as ‘typedef struct uint32_t uint32_t’

任何建議來解決這個問題?由於

+3

這不符合我的任何CUDA的發生基礎,因爲據我可以告訴。我可以包含'stdint.h'和/或直接使用'uint32_t'而不會出現問題。所以我懷疑你有沒有告訴我們你的環境。也許你應該提供一個簡短的小程序,演示了問題,然後提供你正在使用編譯,與你的機器配置(OS,CUDA版本等) –

+0

@clouddy沿着精確的命令行,請註明答案之一正確。我會推薦前兩個答案中的任何一個。 – Andrew

回答

3

嘗試#include <cstdint>std::uint32_t

1

Mybe這可以幫助?

可能的#include cstdint,但可能並不總是工作,或嘗試

#if defined __UINT32_MAX__ or UINT32_MAX 
    #include <inttypes.h> 
    #else 
    typedef unsigned char uint8_t; 
    typedef unsigned short uint16_t; 
    typedef unsigned long uint32_t; 
    typedef unsigned long long uint64_t; 
    #endif 
+0

我之前嘗試過,但這並沒有解決。 – clouddy

+0

這樣的事情僅僅是必要的,如果您使用的是編譯器好好嘗試一下符合標準(這當然可能是NVCC真!) –

0

可以檢查uint32_t的是如何在vector_types.h定義,也許有一些東西的#ifndef已經存在,你可以通過你的重新排序包括脫身。我通過谷歌發現了this版本,但根本沒有uint32_t聲明。