I think I ran into one of those exotic circumstances. I have some old code
that uses gethostbyname, which is now getaddrinfo. Well even though the
seem to be a TCHAR *version of getaddinfo, only a char *.
investigate the problem.
AliR.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
Well, it would be useful to know where you are using 'char *', which
should now be thought
of as obsolete except in rare and exotic circumstances. For example, if
you had a
function that said
void MyFunction(const char * parm)
or
void MyFunction(LPCSTR parm)
then these are erroneous in a native VS2005 app, and should be written as
void MyFunction(const TCHAR * parm)
or
void MyFunction(LPCTSTR parm)
you will have to replace all dead functions such as strcmp with _tcscmp,
and better still,
all instances of the well-and-truly obsolete strcpy or strcat with
_tcscpy_s or _tcscat_s.
But you can't really use char * to represent character data reliably
starting with VS2005,
because its default mode is Unicode. So while it DOES have an (LPCTSTR)
implicit cast on
CString, the problem is that if you tried
CString s = ...;
MyFunction(s);
then if you had used const TCHAR * or LPCTSTR as the parameter type it
would work, but if
you use const char * or LPCSTR, these have been obsolete for years and it
won't compile,
and you will get exactly the error you see.
joe
On Tue, 25 Sep 2007 13:07:21 -0700, DBC User <dbcuser@gmail.com> wrote:
Hi,
I have a VS2003 C++ project that I converted into VS2005 (automatic)
and I got bunch of error during linking (no errors in compling) with
lib files, as I traced the linked libraries I found out that, some of
that are linked in VC 2.0 and those libs are no longer in use, so I
decided to refactor the project.
So I started the main project (MDC DLL) and started adding the
required C++ and h files in to the project. When I build my basic
project with only main modules I got almost 170 errors with following
description
error C2440: 'type cast' : cannot convert from 'CString' to 'const
char *'
When I compiled my automatic conversion project I didn't get any of
these errors. Could someone tell me am I missing any headers or
anything, if you need more information please let me know.
Thanks.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm