开发者

C2440 'initialising': Cannot convert int to unsigned char* in Microsoft VS 2010 utility file

开发者 https://www.devze.com 2023-03-23 05:47 出处:网络
When I compile my VS 2010 C++ project the following passage raises an error in file c:\\program files\\microsoft visual studio10.0\\vc\\include\\utility

When I compile my VS 2010 C++ project the following passage raises an error in file c:\program files\microsoft visual studio 10.0\vc\include\utility

template<class _Other1,
    class _Other2>
    _Pair_base(_Other1&& _Val1, _Other2&& _Val2)
    : first(_STD forward<_Other1>(_Val1)),
        second(_STD forward<_Other2>(_Val2))
    {   // construct from moved values
    }

The error is then followed by another error C2439 'std::_Pair_base..::first element could not be converted'

(All errors translated from German, so they may sound slig开发者_开发百科htly different in English)

I am trying to compile the AxCrypt project on VS 2010, the project files have automatically been converted from VS 2008 (but I don't know if it would work there, I only have VS 2010).


The problem was in the Crypto++ lib used which needs two small modifications before compiling on VS 2010.

a) pubkey.h line 243: 
return HashIdentifier(NULL, 0); 
-> 
return HashIdentifier((const byte*)NULL, 0); 
b) zdeflate.cpp line 389 
#if defined(_STDEXT_BEGIN) && !(defined(_MSC_VER) && _MSC_VER < 1400) 
&& !defined(_STLPORT_VERSION) 
-> 
#if defined(_STDEXT_BEGIN) && !(defined(_MSC_VER) && (_MSC_VER < 1400 
|| _MSC_VER >= 1600)) && !defined(_STLPORT_VERSION) 

More details here: http://groups.google.com/group/cryptopp-users/browse_thread/thread/714f3ec6287a50b1


This code can reproduce this error:

pair<int,char*> aPair(10,20);

Since second type I specified is of char* but I am passing an int, which cannot be converted to char*.

Note that this is oversimplified sample for the error you might be encountering. Probably you are using a map.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号