error C2371: 'int8_t' : redefinition; different basic types ?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: error C2371: 'int8_t' : redefinition; different basic types ?

  1. #1
    Join Date
    Mar 2009
    Posts
    166

    error C2371: 'int8_t' : redefinition; different basic types ?

    Hello,

    In my code I am getting the following compilation errors:

    Code:
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(17): error C2371: 'int8_t' : redefinition; different basic types
    1>          f:\program\sdk_2_0_03\include\NavTypes.h(86) : see declaration of 'int8_t'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(25): error C2371: 'int_least8_t' : redefinition; different basic types
    1>          f:\program\sdk_2_0_03\include\NavTypes.h(97) : see declaration of 'int_least8_t'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(34): error C2371: 'int_fast16_t' : redefinition; different basic types
    1>          f:\program\sdk_2_0_03\include\NavTypes.h(111) : see declaration of 'int_fast16_t'
    1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(38): error C2371: 'uint_fast16_t' : redefinition; different basic types
    1>          f:\program\sdk_2_0_03\include\NavTypes.h(116) : see declaration of 'uint_fast16_t'
    I did a Find in FIles on "int8_t" and I get these results:

    Code:
    in one include file:
    typedef signed char int8_t; // Signed byte   (8 bits)
    
    from stdint.h(17):
    typedef signed char int8_t;
    
    in another include file:
    #ifndef int8_t
    # if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
        typedef signed char int8_t;
    #   define INT8_C(v) ((int8_t) v)
    # else
    #   error "Platform not supported"
    # endif
    #endif
    
    and
    
    #ifndef stdint_least_defined
      typedef   int8_t   int_least8_t;
    If I comment out the last include file, my program compiles fine. When I include it, I get those errors. Any idea how I can fix this?

    Regards,
    Ellay K.
    Last edited by ekhule; February 16th, 2012 at 09:46 AM.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,891

    Re: error C2371: 'int8_t' : redefinition; different basic types ?

    Presumably, this NavTypes.h defines its own versions of these types without properly checking to see if they already exist.

  3. #3
    Join Date
    Mar 2009
    Posts
    166

    Re: error C2371: 'int8_t' : redefinition; different basic types ?

    How can I add code that properly checks if it exists or not?

    Thanks,

  4. #4
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,891

    Re: error C2371: 'int8_t' : redefinition; different basic types ?

    You can try wrapping the NavTypes.h definitions in a namespace, preferably one already used in that header. If this doesn't break anything, it's good enough. If it does, we'll have to dig deeper.

  5. #5
    Join Date
    Mar 2009
    Posts
    166

    Re: error C2371: 'int8_t' : redefinition; different basic types ?

    So just :

    namespace navtypes
    {
    ....
    }

    Like that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center