For Programmers: Free Programming Magazines  


Home > Archive > VC STL > January 2006 > Re: Syntax error when trying to insert a CString object in a set (









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Syntax error when trying to insert a CString object in a set (
ttsoris

2006-01-16, 7:20 pm



"Frank Hickman [MVP]" wrote:

> "ttsoris" <ttsoris@discussions.microsoft.com> wrote in message
> news:A1CE2815-6269-4A73-97C9-6CA3A809D2BB@microsoft.com...
>
> <snip>
>
>
> Since your using stl why are you not using the string class instead of
> CString?
>
> #include <set>
> #include <string>
>
> std::set<string> myStrList;
>
> string s1( "Theo" );
> myStrList.insert( s1 );
>
> But STL is not really my strong suit so I am sure someone will point out any
> errors on my part :-)
>
> --
> ============
> Frank Hickman
> Microsoft MVP
> NobleSoft, Inc.
> ============
> Replace the _nosp@m_ with @ to reply.
>
>
>


The problem was the syntax error produced, not the class I have used. I gave
CString as an example.
The real problem was the statement which is added under any MFC application:

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

If you put the include file(e.g. #include <set> ) before this statement, then
no problem, but if you put it after it, you get this nasty syntax error
:-(((((



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com