February 21, 2008

MFC applications and stringstream under Visual Studio 2003

Posted at February 21, 2008 03:21 PM in Computers .

I am trying to write a simple class which is to be shared between MFC-based and non-MFC (i.e. Win32/CRT) based applications using Visual Studio 2003. I am trying to make the code as portable and generic as possible. In general I've found that, MFC forces you to use the MFC way of doing things. It does not play well with C++ standard libraries. Using them may work or may result in bizarre errors that cannot be debugged without intimate knowledge of the inner workings of MFC and/or the Microsoft implementation of standard C++.

The biggest problem I've seen is with MFC and std::stringstream. I cannot get it to work. A class with a member of type std::stringstream will compile. But when instantiated, an exception occurs in the stringstream constructor (it appears to be a "no memory" type exception which makes absolutely no sense).

If you have encountered similar problems, and have found a solution (other than abandoning C++ standard library calls), I'd love to hear it.

Comments

Posting of new comments has been disabled for this post.