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?
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
您可以尝试使用CString的TrimLeft(),TrimRight()函数。
Using the MFC from the "Microsoft Platform SDK for Windows Server 2003 R2" seems to install an earlier version of MFC where CString doesn't have the Trim() function yet. Use TrimLeft() and TrimRight() in combination instead.
This link to the Visual C++ 6 version of CString documentation shows that the method doesn't exist there, yet: http://msdn.microsoft.com/en-us/library/aa315043%28v=vs.60%29.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.