error C2664 in MFC..?
-
okay These were my main problems cos of which i first used wchar_t and now TCHAR... char str[10]; CString Password; strcpy(str, Password); In above code i get error saying can not convert parameter 2 from 'CString to const char*' TCHAR strFilter[1000]; _tcscpy_s(strFilter, "All Files (*.*)|*.*||"); And error i got is none of the 2 overloads could convert all the arguments type. If i get some other way to deal with this situation... I mean without using wchar_t or TCHAR or L or _T or wcscpy or _tcscpy_s etc etc...then it might work...Dont know really..lez c ..m playing around with it at the moment... Thanks
i guess i got some cause due to which its giving me these error...ill make those changes n will see if it works or not... i would post wtever i get in a bit...
-
ok am getting 4 errors now... Error 27 error LNK2019: unresolved external symbol "public: void __thiscall hide_in_text::hide_file(class CProgressCtrl *)" (?hide_file@hide_in_text@@QAEXPAVCProgressCtrl@@@Z) referenced in function "public: void __thiscall CABCDlg::OnHide(void)" (?OnHide@CABCDlg@@QAEXXZ) ABCDlg.obj Error 28 error LNK2019: unresolved external symbol "public: void __thiscall secret_file_class::get_secret_file(void)" (?get_secret_file@secret_file_class@@QAEXXZ) referenced in function "public: void __thiscall CABCDlg::OnHide(void)" (?OnHide@CABCDlg@@QAEXXZ) ABCDlg.obj Error 29 error LNK2019: unresolved external symbol "public: void __thiscall message_class::convert_to_bits(void)" (?convert_to_bits@message_class@@QAEXXZ) referenced in function "public: void __thiscall CABCDlg::OnHide(void)" (?OnHide@CABCDlg@@QAEXXZ) ABCDlg.obj Error 30 fatal error LNK1120: 3 unresolved externals N:\ABC\Debug\ABC.exe
Hi, These errors or not due to TCHAR or wifstream. Have you included the file with the definition for hide_in_text::hide_file, secret_file_class::get_secret_file, ... I think the definition for these are missing. Best Regards Raj
-
Software_Specialist wrote:
_tcscpy_s(strFilter, "All Files (*.*)|*.*||");
Doesn't this require three arguments? The string literal needs to use
_T()
orL
. In any case, do you really need to usewchar_t
variables?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
# Doesn't this require three arguments? No it was working ...So i guess its right...anyway i think i hv some problem in one of my function so ill try to modify it a bit....
-
# Doesn't this require three arguments? No it was working ...So i guess its right...anyway i think i hv some problem in one of my function so ill try to modify it a bit....
Software_Specialist wrote:
No it was working ...So i guess its right
So what of your "And error i got is none of the 2 overloads could convert all the arguments type." comment? That does not sound like it is working, or right, to me.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi, These errors or not due to TCHAR or wifstream. Have you included the file with the definition for hide_in_text::hide_file, secret_file_class::get_secret_file, ... I think the definition for these are missing. Best Regards Raj
Yeh you are right...thats what i am doing now.. declaration was missing...by mistake it got deleted... I am rewriting those 2 functions now.....ill update whatever i get by the end... Thanks a lot for all your help...
-
Software_Specialist wrote:
No it was working ...So i guess its right
So what of your "And error i got is none of the 2 overloads could convert all the arguments type." comment? That does not sound like it is working, or right, to me.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
oh by that i meant to say it was working like this...
CString strFilter; const TCHAR *strSource= _T("All Files (*.*)|*.*||"); _tcscpy_s(strFilter, strSource);
So Parameter isn't a problem in that... -
oh by that i meant to say it was working like this...
CString strFilter; const TCHAR *strSource= _T("All Files (*.*)|*.*||"); _tcscpy_s(strFilter, strSource);
So Parameter isn't a problem in that...Software_Specialist wrote:
CString strFilter; const TCHAR *strSource= _T("All Files (*.*)|*.*||"); _tcscpy_s(strFilter, strSource);
:confused: How is this not generating a compiler error? I would have expected it to be:
_tcscpy_s(strFilter.GetBuffer(128), strSource);
In any case, why would you want to use
_tcscpy_s()
with aCString
object? That makes no sense.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Software_Specialist wrote:
CString strFilter; const TCHAR *strSource= _T("All Files (*.*)|*.*||"); _tcscpy_s(strFilter, strSource);
:confused: How is this not generating a compiler error? I would have expected it to be:
_tcscpy_s(strFilter.GetBuffer(128), strSource);
In any case, why would you want to use
_tcscpy_s()
with aCString
object? That makes no sense.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
Sorry... my brain is nt workin enough nw....need lil break.. actually it was TCHAR strFilter[1000]; const TCHAR *strSource=_T("All Files(*.*)|*.*||"); _tcscpy_s(strFilter, strSource); And this was definately working....i tested it aswell Rest ill find out after i finish writing these functions ....hoping for the best...:)
-
Sorry... my brain is nt workin enough nw....need lil break.. actually it was TCHAR strFilter[1000]; const TCHAR *strSource=_T("All Files(*.*)|*.*||"); _tcscpy_s(strFilter, strSource); And this was definately working....i tested it aswell Rest ill find out after i finish writing these functions ....hoping for the best...:)
Software_Specialist wrote:
TCHAR strFilter[1000]; const TCHAR *strSource=_T("All Files(*.*)|*.*||"); _tcscpy_s(strFilter, strSource);
So why introduce an unnecessary variable (i.e.,
strSource
) whenTCHAR strFilter[1000];
_tcscpy_s(strFilter, _T("All Files(*.*)|*.*||"));would have sufficed? Since you are using MFC, why bother with
wchar_t
variables at all?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Software_Specialist wrote:
TCHAR strFilter[1000]; const TCHAR *strSource=_T("All Files(*.*)|*.*||"); _tcscpy_s(strFilter, strSource);
So why introduce an unnecessary variable (i.e.,
strSource
) whenTCHAR strFilter[1000];
_tcscpy_s(strFilter, _T("All Files(*.*)|*.*||"));would have sufficed? Since you are using MFC, why bother with
wchar_t
variables at all?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
may be u are right...But i tried that way but it was not working ..yeh i didnt included _T at that time...So ill check out if it works without const TCHAR variable... Thanks for pointing me out...