Hey all,

I have just updated to MS VS 2008 Pro. I am having some cross over problems from MS VC 6. Below is a simple example:

#include<afx.h>
#include<iostream>

using namespace std;

int main()
{
	CString s;
	CString sa("Strings ");
	CString sb = CString("are easy ");
	CString sc = "in MFC!";
	s = sa + sb + sc + '!';
	cout << s;
	return 0;
}

In MSVC 6 thisworks fine but in MSVS 2008 Pro the output is different on every run, typical output "0019ED10" . I do not understand what is happening here. Anyone any ideas? Thanks for the help.

Colm

Recommended Answers

All 4 Replies

Where is CString declared? Is it a visual studio thing? Because CString is definitely not a standard c++ thing.

Hey David,

thanks for the reply. I should have pointed out that I am using MFC programming and CString is defined in the header <afx.h>

Colm

>>I do not understand what is happening here

Microsoft completely rewrote CString to convert it from a c++ class in VC++ 6.0 compiler to a template in VC++ 2005 and later compilers. There were lots of changes to MFC, and CString was just one of them. Consequently you may have to rewrite parts of your programs to conform to the new version of MFC.

commented: Thanks for your help +1

Thanks Ancient Dragon,
at least its not me going mad, which i was being to think was a posibility :). I guess I go find a book that explains MFC for MSVS 2008 as I am afraid to think of any other changes microsoft may have carried out. Thanks for the heads up again.

Colm

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.