Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CString 'Trim' : is not a member, why?

I have simple app that I try to compile with VC express and using the:
Microsoft platform SDK for Windows server 2003 that contains MFC and ATL. Now I have this simple code :

CString strValue("test");
CString s = strValue.Trim();
LPCTSTR lpStr = (LPCTSTR)strValue.Trim()

that give me a compilation error : c:\dev\test.cpp(463) : error C2039: 'Trim' : is not a member of 'CString' c:\program files\microsoft platform sdk for windows server 2003 r2\include\mfc\afx.h(369) : see declaration of 'CString'

do I have a problem with the platform SDK and vc express?

like image 582
user63898 Avatar asked Jul 05 '10 11:07

user63898


People also ask

How do you assign a value to CString?

You can assign C-style literal strings to a CString just as you can assign one CString object to another. Assign the value of a C literal string to a CString object. CString myString = _T("This is a test"); Assign the value of one CString to another CString object.

What is CString used for?

A CString object keeps character data in a CStringData object. CString accepts NULL-terminated C-style strings. CString tracks the string length for faster performance, but it also retains the NULL character in the stored character data to support conversion to LPCWSTR .

What is MFC CString?

Advertisements. Strings are objects that represent sequences of characters. The C-style character string originated within the C language and continues to be supported within C++. This string is actually a one-dimensional array of characters which is terminated by a null character '\0'.


1 Answers

Visual C++ Express Edition don't has built in support for ATL and MFC (CString is an MFC class, implemented as the shared MFC/ATL CStringT class: documentation).

If you really can't afford the Standard Edition, you can rely on this howto to add ATL and MFC support by installing the DDK: http://www.codeproject.com/KB/MFC/MFCinVisualStudioExpress.aspx

like image 50
lornova Avatar answered Oct 03 '22 03:10

lornova