1

When I try to compile my program first I got this error:

error: ‘uint32_t’ does not name a type

Then I included

#include <stdint.h>

Now it turned out this error:

/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’

Any suggestion to solve this ? Thanks

Community
  • 1
  • 1
clouddy
  • 891
  • 2
  • 8
  • 10
  • 3
    This doesn't happen with any of my cuda builds as far as I can tell. I can include `stdint.h` and/or just use `uint32_t` directly without issues. So I suspect there is something you're not telling us about your environment. Perhaps you should provide a short little program that demonstrates the issue, and then provide the exact command line you are using to compile, along with your machine config (OS, CUDA version, etc.) – Robert Crovella May 24 '14 at 05:14
  • @clouddy, please mark one of the answers as correct. I'd recommend any of the first two answers. – Andrew Aug 31 '17 at 18:59

3 Answers3

3

Try #include <cstdint> and std::uint32_t.

Brian Bi
  • 111,498
  • 10
  • 176
  • 312
1

Mybe this can help ?

maybe #include cstdint, but that may not always work or try

#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
mad_mask
  • 776
  • 2
  • 10
  • 31
  • I tried this before but this did not work out either. – clouddy May 24 '14 at 05:09
  • This sort of thing is only necessary if you're using a compiler that doens't comply with the standards (which of course may be true for nvcc!) – M.M May 24 '14 at 05:20
0

You can check how uint32_t is defined in vector_types.h, maybe there's some #ifndef stuff already exists and you can get away just by reordering your includes. I've found this version via google but there's no uint32_t declaration at all.

bigblackdot
  • 138
  • 1
  • 9