Click here to Skip to main content
15,894,907 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to find where the EXIT_SUCCESS and EXIT_FAILURE included please? Pin
Stuart Dootson21-Jul-09 2:30
professionalStuart Dootson21-Jul-09 2:30 
QuestionMemory function equivalent to that found in fread Pin
alleyes21-Jul-09 1:32
professionalalleyes21-Jul-09 1:32 
AnswerRe: Memory function equivalent to that found in fread Pin
«_Superman_»21-Jul-09 2:37
professional«_Superman_»21-Jul-09 2:37 
GeneralRe: Memory function equivalent to that found in fread Pin
alleyes21-Jul-09 3:15
professionalalleyes21-Jul-09 3:15 
GeneralRe: Memory function equivalent to that found in fread Pin
alleyes24-Jul-09 5:40
professionalalleyes24-Jul-09 5:40 
GeneralRe: Memory function equivalent to that found in fread Pin
«_Superman_»24-Jul-09 17:13
professional«_Superman_»24-Jul-09 17:13 
GeneralRe: Memory function equivalent to that found in fread Pin
alleyes25-Jul-09 1:16
professionalalleyes25-Jul-09 1:16 
QuestionUse template with "Conversion Functions" get problem. [modified] Pin
hawkgao012921-Jul-09 0:28
hawkgao012921-Jul-09 0:28 
I use VC++9.0/VS2008. It seems template cannot work with operator. In Conversion Function, the operator's name cannot be or with template. Compiler probably doesn't have ability to deduce it. But the following code is really compilable in VC++6.0, which CString doesn't have template. Any suggestion? Thanks in advance!

Here is my code:

class TestString {
	CString m_str;
public:
	TestString(TCHAR* str):m_str(str) {}
	operator CString() const {return m_str;}
};


int main(void)
{
		TestString t1(_T("test1"));
		TestString t2(_T("test2"));
		CString strTest = t1 + t2; // compiler error. but if "CString strTest = t1 + (CString)t2;". it work fine.
		return 0;
}


And Here is the error message:

1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>Compiling...
1>Test.cpp
1>c:\build\test\test\test.cpp(19) : error C3767: '+': candidate function(s) not accessible
1>        could be the friend function at 'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(653)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(664)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(675)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2034)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2043)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2052)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2061)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2071)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2081)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2091)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(653)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(664)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(675)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2034)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2043)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2052)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2061)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2071)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2081)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2091)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(653)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(664)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(675)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(653)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(664)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlsimpstr.h(675)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2034)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2043)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2052)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2061)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2071)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2081)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2091)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2034)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2043)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2052)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2061)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2071)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2081)' : '+'  [may be found via argument-dependent lookup]
1>        or the friend function at       'c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\cstringt.h(2091)' : '+'  [may be found via argument-dependent lookup]
1>c:\build\test\test\test.cpp(19) : error C2676: binary '+' : 'TestString' does not define this operator or a conversion to a type acceptable to the predefined operator
1>Build log was saved at "file://c:\Build\Test\Test\Debug\BuildLog.htm"
1>Test - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


modified on Tuesday, July 21, 2009 6:35 AM

AnswerRe: Use template with "Conversion Functions" get problem. Pin
«_Superman_»21-Jul-09 0:36
professional«_Superman_»21-Jul-09 0:36 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
hawkgao012921-Jul-09 0:52
hawkgao012921-Jul-09 0:52 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
«_Superman_»21-Jul-09 0:59
professional«_Superman_»21-Jul-09 0:59 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
hawkgao012921-Jul-09 1:10
hawkgao012921-Jul-09 1:10 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
«_Superman_»21-Jul-09 1:20
professional«_Superman_»21-Jul-09 1:20 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
hawkgao012921-Jul-09 3:13
hawkgao012921-Jul-09 3:13 
AnswerRe: Use template with "Conversion Functions" get problem. Pin
Stuart Dootson21-Jul-09 3:25
professionalStuart Dootson21-Jul-09 3:25 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
hawkgao012921-Jul-09 16:30
hawkgao012921-Jul-09 16:30 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
Stuart Dootson21-Jul-09 16:44
professionalStuart Dootson21-Jul-09 16:44 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
hawkgao012921-Jul-09 19:02
hawkgao012921-Jul-09 19:02 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
Stuart Dootson21-Jul-09 19:53
professionalStuart Dootson21-Jul-09 19:53 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
hawkgao012921-Jul-09 21:40
hawkgao012921-Jul-09 21:40 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
Stuart Dootson21-Jul-09 22:27
professionalStuart Dootson21-Jul-09 22:27 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
hawkgao012921-Jul-09 23:01
hawkgao012921-Jul-09 23:01 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
Stuart Dootson21-Jul-09 23:13
professionalStuart Dootson21-Jul-09 23:13 
GeneralRe: Use template with "Conversion Functions" get problem. [modified] Pin
hawkgao012921-Jul-09 23:25
hawkgao012921-Jul-09 23:25 
GeneralRe: Use template with "Conversion Functions" get problem. Pin
Stuart Dootson22-Jul-09 0:11
professionalStuart Dootson22-Jul-09 0:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.