Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CString help

Status
Not open for further replies.

CrazyScorpion

Programmer
Jul 2, 2010
5
0
0
US
The version of VS I'm using is VS 2005 Express
I'm trying to create a string object using the CString keyword.

The syntax is womething like the following:

CString Objective;

The compiler errors I'm receiving are:

1>c:\users\gary\documents\visual studio 2005\projects\r20modern\r20modern\Form1.h(146) : error C2146: syntax error : missing ';' before identifier 'Objective'
1>c:\users\gary\documents\visual studio 2005\projects\r20modern\r20modern\Form1.h(146) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\gary\documents\visual studio 2005\projects\r20modern\r20modern\Form1.h(146) : error C2144: syntax error : 'int' should be preceded by ';'
1>c:\users\gary\documents\visual studio 2005\projects\r20modern\r20modern\Form1.h(146) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
 
You need to pull in MFC support for 2005 from full blown visual studio. Alternatively, use WTL (
It is like MFC but uses templates instead of a massive library. Also generates smaller code footprint and does not have a dependency on the different variants of the MFC dll.
 
Thanks guys

I'll try to download the WTL. Are there any advantages to using that dll compared to MFC.
 
BTW, SDowd, I'm not sure if I'm using AFX.h or not! I'm basically an C++ Builder coder, and havn't yet learned all the options that Microsoft offers me as yet!
 
WTL isn't a library as such - it is just a bunch of templates using the SDK.

CString probably still won't work. You could try std::string (#include <string>) which is the STL way of doing things. It doesn't do some of the formatting that CString does but it will do the basics like assignment, comparison and catenation.
 
Sorry take that back, CStrings do work in WTL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top