utility file troubles RRS feed

  • Question

  • I'm trying to compile a project converted from vb6 to vs2010 and the convertion had warnings most were VCWebServiceProxyGeneratorTool is no longer supported and some were Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion and the rest were program was updated to include the UAC. i'm trying to build the program and seem to get the same two errors both in the utility file c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): error C2440: 'initializing' : cannot convert from 'int' to 'const unsigned char *' and c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): error C2439: 'std::_Pair_base<_Ty1,_Ty2>::first' : member could not be initialized both include this code

    _Pair_base(_Other1&& _Val1, _Other2&& _Val2)

    : first(_STD forward<_Other1>(_Val1)),

    second(_STD forward<_Other2>(_Val2))

    error occurs here > {


    // construct from moved values 


    _Ty1 first;


    // the first stored value

    _Ty2 second;


    // the second stored value





    <class _Ty1,



    class _Ty2>

    any help would be great. 
    Sunday, July 4, 2010 1:11 AM


All replies

  • Thanks for the help I'm starting to wonder if the entire program is in c and not c++. The original compiler was visual c and not c++ it's stated that visual c 2008 sp1 will compile the program with no problems at all I guess I'll switch over to a virtual machine and recompile in visual c and see if that fixes the problem. I think I still have visual c 2008 with sp1 somewhere it shoulden't be too hard with xp in the virtual machine. I'm looking for a cryptographic library with the majority of the hashing functions to test a theory.
    Sunday, July 4, 2010 2:34 AM
  • ok i think i found the offending code by diging a bit deeper.




    defined(_STDEXT_BEGIN) && !(defined(_MSC_VER) && _MSC_VER < 1400) && !defined(_STLPORT_VERSION)

    stdext::unchecked_mismatch \\ error c2653 'stdext' is not a class or namespace




    (scan+3, scanEnd, match+3).first - scan); \\ error c2228 left of '.first' must have class/struct/union and error c3861 'unchecked_mismatch' identifier not found

    assert(len != bestLength);


    I hope this is enough code to help you determine if this is c or c++. Thanks again for your help.

    Sunday, July 4, 2010 1:08 PM
  • Check your code for the use of NULL. I've noted that this error does crop up sometimes when using NULL in the context of STL. Changing to nullptr can sometimes solve this problem.
    Sunday, July 4, 2010 3:47 PM
  • #include


















    DH dh1;

    DH dh2(NullRNG(), 10);




    code from one of the many source files generating the error this is one of the smaller files thats why i posted the entire code and the error is

    c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): error C2439: 'std::_Pair_base<_Ty1,_Ty2>::first' : member could not be initialized

    Sunday, July 4, 2010 5:38 PM
  • If you have a file that only contains pch.h, do you still get the error? Or do you need to include dh.h as well? If the former, list the contents of pch.h.

    Sunday, July 4, 2010 6:41 PM
  • Ok without pch.h I get a complaining about the header being missing; without dh.h there are alot of syntax and undeclaired identifiers errors.

    Sunday, July 4, 2010 7:00 PM
  • Hi. I also met the same problem as you did. I tried to comile Crypto++ project with VS2010. Then I got these error:

    utility(163): error C2440: 'initializing' : cannot convert from 'int' to 'const unsigned char *'


    But the project can be easily built with VS2008 resulting no error.

    Have you solved the problem? Could you tell me how? Thank you~

    Wednesday, July 28, 2010 5:26 PM
  • I've found the solution. 2 changes can help to solve the problem. Here are the helpful URL:

    changes are as below:


    file: pubkey.h

    line: 243

    origin code: return HashIdentifier(NULL, 0);

    modified code: return HashIdentifier((const byte*)NULL, 0);


    file: zdeflate.cpp

    line: 389

    origin code: #if defined(_STDEXT_BEGIN) && !(defined(_MSC_VER) && _MSC_VER < 1400) && !defined(_STLPORT_VERSION)

    modified code: #if defined(_STDEXT_BEGIN) && !(defined(_MSC_VER) && (_MSC_VER < 1400 || _MSC_VER >= 1600)) && !defined(_STLPORT_VERSION)

    Thursday, July 29, 2010 4:14 AM
  • This post was unbelievably and incredibly useful!!!!
    Friday, December 16, 2011 9:09 PM
  • Item #2 of this answer appears to be incorrect, as no such lines appear at line 389 of "zdeflate.cpp"

    I have found another modification to "zinflate.h" at line 79 which appears to bypass the remaining problem as follows:

    	unsigned int m_maxCodeBits, m_cacheBits, m_cacheMask, m_normalizedCacheMask;
    	std::vector<CodeInfo> m_codeToValue;
    	mutable std::vector<LookupEntry> m_cache;
    	//std::vector<CodeInfo, AllocatorWithCleanup<CodeInfo> > m_codeToValue;
    	//mutable std::vector<LookupEntry, AllocatorWithCleanup<LookupEntry> > m_cache;

    This allows both the debug and release versions to compile.

    The problem occurs when a VECTOR is defined as an array of STRUCT with a custom allocator/de-allocator and the DEBUG option is selected. In this particular application, the allocator does nothing useful for a STRUCT and can be omitted.


    Thursday, December 6, 2018 11:37 PM
  • Item #2 of this answer appears to be incorrect, as no such lines appear at line 389 of "zdeflate.cpp"

    Considering that this thread is more than 8 years old, I have to ask the
    obvious questions:

    Are you looking at the *exact* same file version as the OP? 

    VS 2010? With the same service packs and updates applied?

    Hard to tell from the available info in this thread.

    - Wayne

    Friday, December 7, 2018 3:51 AM