This repository was archived by the owner on Oct 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
error C2664: cannot convert 'const WCHAR *' to 'const std::basic_string<char1 6_t,std::char_traits<char16_t>,std::allocator<char16_t>> & #241
Copy link
Copy link
Open
Description
Hi, I was unable to compile the following snippet of code:
map<std::u16string, int> intSettings;
int getIntConfigValue(const WCHAR* name, int defaultValue) override
{
if (intSettings.find(name) != intSettings.end())
return intSettings[name];
return defaultValue;
}from Pyjion\cee.h. I'm not quite sure how to fix this easily...
Here's the full log:
[ 33%] Building CXX object CMakeFiles/pyjionlib.dir/Pyjion/pycomp.cpp.obj
pycomp.cpp
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(86): error C2664: 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const std::u16string,int>>>> std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::find(const std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>> &) const': cannot convert argument 1 from 'const WCHAR *' to 'const std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>> &'
with
[
_Kty=std::u16string,
_Ty=int,
_Pr=std::less<std::u16string>,
_Alloc=std::allocator<std::pair<const std::u16string,int>>
]
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(86): note: Reason: cannot convert from 'const WCHAR *' to 'const std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>>'
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(86): note: No constructor could take the source type, or constructor overload resolution was ambiguous
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xtree(1467): note: see declaration of 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::find'
with
[
_Kty=std::u16string,
_Ty=int,
_Pr=std::less<std::u16string>,
_Alloc=std::allocator<std::pair<const std::u16string,int>>
]
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(87): error C2679: binary '[': no operator found which takes a right-hand operand of type 'const WCHAR *' (or there is no acceptable conversion)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\map(324): note: could be 'int &std::map<std::u16string,int,std::less<std::u16string>,std::allocator<std::pair<const std::u16string,int>>>::operator [](const std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>> &)'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\map(153): note: or 'int &std::map<std::u16string,int,std::less<std::u16string>,std::allocator<std::pair<const std::u16string,int>>>::operator [](std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>> &&)'
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(87): note: while trying to match the argument list '(std::map<std::u16string,int,std::less<std::u16string>,std::allocator<std::pair<const std::u16string,int>>>, const WCHAR *)'
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(93): error C2664: 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const std::u16string,const char16_t *>>>> std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::find(const std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>> &) const': cannot convert argument 1 from 'const WCHAR *' to 'const std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>> &'
with
[
_Kty=std::u16string,
_Ty=const char16_t *,
_Pr=std::less<std::u16string>,
_Alloc=std::allocator<std::pair<const std::u16string,const char16_t *>>
]
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(93): note: Reason: cannot convert from 'const WCHAR *' to 'const std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>>'
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(93): note: No constructor could take the source type, or constructor overload resolution was ambiguous
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xtree(1467): note: see declaration of 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::find'
with
[
_Kty=std::u16string,
_Ty=const char16_t *,
_Pr=std::less<std::u16string>,
_Alloc=std::allocator<std::pair<const std::u16string,const char16_t *>>
]
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(94): error C2679: binary '[': no operator found which takes a right-hand operand of type 'const WCHAR *' (or there is no acceptable conversion)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\map(324): note: could be 'const char16_t *&std::map<std::u16string,const char16_t *,std::less<std::u16string>,std::allocator<std::pair<const std::u16string,const char16_t *>>>::operator [](const std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>> &)'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\map(153): note: or 'const char16_t *&std::map<std::u16string,const char16_t *,std::less<std::u16string>,std::allocator<std::pair<const std::u16string,const char16_t *>>>::operator [](std::basic_string<char16_t,std::char_traits<char16_t>,std::allocator<char16_t>> &&)'
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\cee.h(94): note: while trying to match the argument list '(std::map<std::u16string,const char16_t *,std::less<std::u16string>,std::allocator<std::pair<const std::u16string,const char16_t *>>>, const WCHAR *)'
C:\msys64\home\ryuta\packages\pyjion\pyjion\Pyjion\pycomp.h(248): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~4\2019\COMMUN~1\VC\Tools\MSVC\1427~1.291\bin\Hostx64\x64\cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
Metadata
Metadata
Assignees
Labels
No labels