tags:

views:

59

answers:

2

I'm extending an open source project. After including afxcoll.h in a new C++ file in order to use CStringArray, I get this error:

Error: MFC projects cannot define _ATL_NO_EXCEPTIONS

I suspect I'll be able to fix the error by adding #defines or changing or rearranging the inclusion of headers, or, if that's not possible, using something other than CStringArray. What are your suggestions?

Please ask questions in the comments for this question, not in your answer.

+1  A: 

how about ... not defining _ATL_NO_EXCEPTIONS like the error says?

(Ooops thats a question as an answer).

Goz
A: 

You could use CAtlArray<CString> instead of CStringArray, as this is compatible with _ATL_NO_EXCEPTIONS. The ATL collection classes are documented here. I normally prefer to use C++ standard library classes such as std::vector instead of the MFC container classes, though.

I'd suggest investigating why _ATL_NO_EXCEPTIONS is defined in this project and whether it can be removed.

ChrisN
answer chosen for your suggestion of using CAtlArray
Brian