For Programmers: Free Programming Magazines  


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









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 Syntax error when trying to insert a CString object in a set (VC8)
ttsoris

2006-01-12, 7:09 pm

Hello,
I am trying to insert a CString object in a set in Visual Studio 2005, and I
get the following compile error.

d:\program files\microsoft visual studio 8\vc\include\xtree(1317) : error
C2061: syntax error : identifier '_Wherenode'
d:\program files\microsoft visual studio 8\vc\include\xtree(1314) :
while compiling class template member function
'std::_Tree_nod<_Traits>::_Node
*std::_Tree<_Traits>::_Buynode(std::_Tree_nod<_Traits>::_Node
*,std::_Tree_nod<_Traits>::_Node *,std::_Tree_nod<_Traits>::_Node *,const
ATL::CStringT<BaseType,StringTraits> &,char)'
with
[

_Traits=std::_Tset_traits<CString,std::less<CString>,std::allocator<CString>,false>,
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
d:\program files\microsoft visual studio 8\vc\include\set(69) : see
reference to class template instantiation 'std::_Tree<_Traits>' being compiled
with
[

_Traits=std::_Tset_traits<CString,std::less<CString>,std::allocator<CString>,false>
]
d:\holostatika v2\external executables\mdiplot\mdiplotdoc.cpp(630) :
see reference to class template instantiation 'std::set<_Kty>' being compiled
with
[
_Kty=CString
]


This is the code I am using
#include <set>
std::set<CString> MyStrList;
CString s1 = "Theo";
MyStrList.insert(s1);


Any ideas?

Thank you,
Theofilos
Frank Hickman [MVP]

2006-01-13, 7:58 am

"ttsoris" <ttsoris@discussions.microsoft.com> wrote in message
news:A1CE2815-6269-4A73-97C9-6CA3A809D2BB@microsoft.com...
> Hello,
> I am trying to insert a CString object in a set in Visual Studio 2005, and
> I
> get the following compile error.
>


<snip>

>
> This is the code I am using
> #include <set>
> std::set<CString> MyStrList;
> CString s1 = "Theo";
> MyStrList.insert(s1);
>
>
> Any ideas?
>
> Thank you,
> Theofilos


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.


Sponsored Links







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

Copyright 2008 codecomments.com