I'm a long time Java/C# developer, and I'm trying to teach myself C++, specifically MFC, using a book by Richard Jones that was published in 2000.
I'm getting this compile error:
'ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>::Format': no overloaded function could convert all the argument types
On the following code that I typed in from an example in the book:
int r;
double rd;
int i;
CString s;
std::cout << "\nLargest random integer: " << RAND_MAX << std::endl;
//Provide seed for generator
srand((unsigned)time(NULL));
std::cout << "\n5 random integers: \n";
for (i = 0; i < 5; i++) {
r = rand();
s.Format("%d ", r);
std::cout << s << std::endl;
}
I'm using Visual Studio 2022, and I'm wondering if I need to configure it differently to use examples from over 20 years ago?
Perhaps related to my confusion, I don't even see a CString
class listed here: Walkthrough: Using the New MFC Shell Controls - only CStringArray
and CStringList
.
As directed in my book, I'm trying to use these MFC classes in a console program as a starting point. I have my C++ Language Standard set to "Default (ISO C++14 Standard)" in the project properties. I'm wondering if it would help to set it to whatever the standard was around the year 2000?