Avatar of william007
william007

asked on 

error C2065: 'CString' : undeclared identifier

I am using visual C++ 2005(native C++)

I got the error
error C2065: 'CString' : undeclared identifier
for the following code,
what is the problem?
#include <cstring>
using namespace std;
 
int main(){
	CString ab;
	ab="a";
}

Open in new window

Editors IDEsC++

Avatar of undefined
Last Comment
william007
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
also, that will work only if you have declared your project as MFC application.
Avatar of jkr
jkr
Flag of Germany image

Did you mean the following?
#include <string>
using namespace std;
 
int main(){
        string ab;
        ab="a";
}

Open in new window

SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

>> There is. It's the C++ equivalent
Just to clarify, all of the old C++ headers not have C++ versions, there they start with a c and drop the .h suffix. For example, cstdlib, cstdio. The (main) difference is that these headers place standard C functions into the std namespace. When coding in C you should use the normal C versions, when coding in C++ you should use the new versions. The C style headers are considered deprecated in C++.

A list of the standard C++ headers can be found here: http://www.cplusplus.com/reference/clibrary/
SOLUTION
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of william007
william007

ASKER

Thanks:)
C++
C++

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

58K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo