Help with error in Visual C ++ 2010

0

Good afternoon, someone could help me with the following problem in my c ++ code.

1>  Generating Code...
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(54): warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_STANDA'
1>  
2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(76): warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_SECURE'
1> 
1>  Info.vcxproj -> C:\Users\gramt\Documents\Visual Studio 2010\Projects\Info\Debug\Info.exe

1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(54): warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_STANDA' 

This error corresponds to this code within the header string.h

The code:

#if defined(__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY
extern "C++"
{
 #ifndef _CRT_ENABLE_IF_DEFINED
  #define _CRT_ENABLE_IF_DEFINED
    template<bool _Enable, typename _Ty>
    struct _CrtEnableIf;

    template<typename _Ty>
    struct _CrtEnableIf<true, _Ty>
    {
        typedef _Ty _Type;
    };
 #endif
    template <size_t _Size, typename _DstType>
    inline
    typename _CrtEnableIf<(_Size > 1), void *>::_Type __cdecl memcpy(_DstType (&_Dst)[_Size], _In_opt_bytecount_(_SrcSize) const void *_Src, _In_ size_t _SrcSize) _CRT_SECURE_CPP_NOTHROW
    {
        return memcpy_s(_Dst, _Size * sizeof(_DstType), _Src, _SrcSize) == 0 ? _Dst : 0;
    }
}
#endif

Another error:

2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(76): warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_SECURE'

This error corresponds to this code within the header string.h

The code:

#if defined(__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY
extern "C++"
{
    template <size_t _Size, typename _DstType>
    inline
    errno_t __CRTDECL memcpy_s(_DstType (&_Dst)[_Size], _In_opt_bytecount_(_SrcSize) const void * _Src, _In_ rsize_t _SrcSize) _CRT_SECURE_CPP_NOTHROW </P>
    {
        return memcpy_s(_Dst, _Size * sizeof(_DstType), _Src, _SrcSize);
    }
}
#endif
    
asked by jose_luis_rangel 19.11.2017 в 21:27
source

1 answer

1

To begin with, they are not error messages but warning messages (it is not the same error as warning although you have to pay attention to both types of messages).

Next, if we take a look at Microsoft's documentation about the error:

  

identifier truncated in 'identifier'

     

An identifier was too long and has been truncated in the name that appears in the warning.

So it seems that the origin of the problem is exactly the same as the one the compiler is showing you:

warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_STANDA'
                ^^^^^^^^^^^^^^^^^^^^

A solution is then to reduce the length of the identifier to avoid the warning message.

By the way, it shows you a warning instead of an error because the code can compile ... the warning is present because when truncating the identifiers it can happen that two different ones end up matching.

Seen the seen the size of the identifiers in VS2010 is limited to 31 characters (32 if we add the string finisher).

As a final note. I do not know what you intend with that of extern C++ but it does not work for absolutely nothing . Well, let's clarify it a bit.

extern C serves to allow a link to the use of C, which allows creating code compatible with C and with C ++ (a binding interface). Instead extern C++ allows, in the case of working with C, to indicate that there is C ++ code ... which allows the compiler to ignore that instruction and be so happy ... I doubt very much that you are mixing compilers in your case so it's better to stop using that feature, which will allow you to clean the code a bit.

    
answered by 20.11.2017 в 08:50