S
SteveK
We have just started converting a large project from VisualStudio 6.0 to VisualStudio 2003. Of course, we're encountering some problems.
The first of which involves some CString() constructors not taking arguments that were valid in the 6.0 builds.
As a test, a created a simple 2003 project and inserted the following six lines of code in the stdafx.cpp file:
#include "stdafx.h"
TCHAR x = 't';
CString s(x);
UCHAR uc = 'u';
CString s2(uc);
WCHAR wc = 'w';
CString s3(wc);
and I get the following compiler error:
c:\Temp\TestDotNet2003\TestDotNet2003\stdafx.cpp(15): error C2668: 'ATL::CStringT<BaseType,StringTraits>::__ctor' : ambiguous call to overloaded function
with
[
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
and
[
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
If I try the same thing with the 6.0 compiler, I get the following results:
c:\documents and settings\stevek\my documents\shamrockii_1_0\stdafx.cpp(27) : warning C4244: 'argument' : conversion from 'unsigned short' to 'char', possible loss of data
WCHAR wc = 'w';
CString s3(wc); // offending line
If in the Stdafx.cpp file of the 2003 project, I right-click on CString and select the "Go To Definition", I goto line 103 of afxstr.h
typedef ATL::CStringT< TCHAR, StrTraitMFC< TCHAR > > CString;
and then if I again right-click on TCHAR and select "Go To Definition", I get to line 141 of tchar.h
#ifndef _TCHAR_DEFINED
#if !__STDC__
typedef wchar_t TCHAR; // line 141
#endif
#define _TCHAR_DEFINED
#endif
it appears that TCHAR has a typedef of wchar_t.
If I following the same steps ("Go To Definition") I get to:
#ifndef _TCHAR_DEFINED
typedef char TCHAR, *PTCHAR; // line 324 of WinNT.h
typedef unsigned char TBYTE , *PTBYTE ;
#define _TCHAR_DEFINED
#endif /* !_TCHAR_DEFINED */
Why is TCHAR being defined as wchar_t in the VS 2003 project?
Does anyone have a list of common problems and tips we could follow while in the process of converting a large project.
Any help would be appreciated.
The first of which involves some CString() constructors not taking arguments that were valid in the 6.0 builds.
As a test, a created a simple 2003 project and inserted the following six lines of code in the stdafx.cpp file:
#include "stdafx.h"
TCHAR x = 't';
CString s(x);
UCHAR uc = 'u';
CString s2(uc);
WCHAR wc = 'w';
CString s3(wc);
and I get the following compiler error:
c:\Temp\TestDotNet2003\TestDotNet2003\stdafx.cpp(15): error C2668: 'ATL::CStringT<BaseType,StringTraits>::__ctor' : ambiguous call to overloaded function
with
[
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
and
[
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
If I try the same thing with the 6.0 compiler, I get the following results:
c:\documents and settings\stevek\my documents\shamrockii_1_0\stdafx.cpp(27) : warning C4244: 'argument' : conversion from 'unsigned short' to 'char', possible loss of data
WCHAR wc = 'w';
CString s3(wc); // offending line
If in the Stdafx.cpp file of the 2003 project, I right-click on CString and select the "Go To Definition", I goto line 103 of afxstr.h
typedef ATL::CStringT< TCHAR, StrTraitMFC< TCHAR > > CString;
and then if I again right-click on TCHAR and select "Go To Definition", I get to line 141 of tchar.h
#ifndef _TCHAR_DEFINED
#if !__STDC__
typedef wchar_t TCHAR; // line 141
#endif
#define _TCHAR_DEFINED
#endif
it appears that TCHAR has a typedef of wchar_t.
If I following the same steps ("Go To Definition") I get to:
#ifndef _TCHAR_DEFINED
typedef char TCHAR, *PTCHAR; // line 324 of WinNT.h
typedef unsigned char TBYTE , *PTBYTE ;
#define _TCHAR_DEFINED
#endif /* !_TCHAR_DEFINED */
Why is TCHAR being defined as wchar_t in the VS 2003 project?
Does anyone have a list of common problems and tips we could follow while in the process of converting a large project.
Any help would be appreciated.