c++ - error C2440: 'initializing' : cannot convert from 'const jchar *' to 'LPCWSTR' in Visual Studio 2008 -
my java code using native method (win api) opening file native method implemented in c++. dont have idea win api. when try compile c++ project, getting above mentioned error.
the code responsible error follows:
std::wstring getunicodestring(jnienv *env, jstring str) { jboolean iscopy; jsize len = env->getstringlength(str); lptstr unicodestring = (lptstr) malloc (2 * len + 2); memset (unicodestring, 0, 2 * len + 2); lpcwstr tempstr = env->getstringchars(str, &iscopy); // <--- line memcpy(unicodestring, tempstr, 2 * len ); std::wstring result = unicodestring; env->releasestringchars(str, tempstr); delete unicodestring; return result; }
i getting error in highlighted line. thought must conversion error did typecasting. after typecasting, error in particular line got resolved got many errors based on dependency.
i think there no problem code because code got compiled several times previously. think might unicode settings issue in visual studio. please
project properties>c/c++/language/treat wchar_t builtin type" set no.
Comments
Post a Comment