Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > error C2440: 'return' : cannot convert from 'const char *' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Reply
Thread Tools

error C2440: 'return' : cannot convert from 'const char *' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

 
 
Abhijit Bhadra
Guest
Posts: n/a
 
      12-01-2004
Hi ,
I was trying to build my project in VC with latest Service Packs but
got this error .

C:\Program Files\Microsoft Visual
Studio\VC98\ATL\INCLUDE\atlconv.h(125) : error C2440: 'return' :
cannot convert from 'const char *' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast

I am using some ATL functionality ( String conversion)
In Preprocessor setting I have made UNICODE and _UNICODE , but no
change in error .

Any help is highly solicited .

Thanks,
Abhijit
 
Reply With Quote
 
 
 
 
Sharad Kala
Guest
Posts: n/a
 
      12-01-2004

"Abhijit Bhadra" <(E-Mail Removed)> wrote in message
> Hi ,
> I was trying to build my project in VC with latest Service Packs but
> got this error .
>
> C:\Program Files\Microsoft Visual
> Studio\VC98\ATL\INCLUDE\atlconv.h(125) : error C2440: 'return' :
> cannot convert from 'const char *' to 'const unsigned short *'
> Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
>
> I am using some ATL functionality ( String conversion)
> In Preprocessor setting I have made UNICODE and _UNICODE , but no
> change in error .


You have to post some code to get better replies. If it has a lot of
non-Standard stuff then try the news:microsoft.vc.* family of newsgroups.

Sharad


 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      12-01-2004
Abhijit Bhadra wrote:
> Hi ,
> I was trying to build my project in VC with latest Service Packs but
> got this error .
>

unsigned short is a goofup on Microsoft's part because wchar_t isn't
a distinct type there. When you seem char vs. unsigned short issues,
you've screwed up a char vs. wchar_t somewhere.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Casting from const pair<const unsigned char*, size_t>* to constpair<unsigned char*, size_t>* Alex Vinokur C++ 9 10-13-2008 05:05 PM
char *, unsigned char * and POD types john C++ 12 12-15-2007 04:59 PM
Linking error LNK2001 - "__declspec(dllimport) private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Tidy(unsigned short)" (__imp_?_Tidy@?$basic_string@DU?$char_ sharmadeep1980@gmail.com C++ 1 07-07-2006 07:27 AM
how to cast unsigned char to char? zl2k C++ 1 03-17-2006 04:48 AM
void*, char*, unsigned char*, signed char* Steffen Fiksdal C Programming 1 05-09-2005 02:33 AM



Advertisments