Solved

CString undeclared in C++ when build

Posted on 2008-10-08
2
692 Views
Last Modified: 2012-08-13
I had error C2065: 'CString' : undeclared identifier when building win32 console app EXE. I need to use CString variable in the future. how to get it valid?

Thanks.
#include <iostream>
 
using namespace std;
void main()
{
  CString s;
 
  cout << "Hello World!" << endl;   
  cout << "Welcome to C++ Programming" << endl; 
}
 
After build:
Deleting intermediate files and output files for project 'AA - Win32 Debug'.
--------------------Configuration: AA - Win32 Debug--------------------
Compiling...
AA_test.cpp
c:\myproject\aa\aa_test.cpp(8) : error C2065: 'CString' : undeclared identifier
c:\myproject\aa\aa_test.cpp(8) : error C2146: syntax error : missing ';' before identifier 's'
c:\myproject\aa\aa_test.cpp(8) : error C2065: 's' : undeclared identifier
Error executing cl.exe.
 
AA.exe - 3 error(s), 0 warning(s)

Open in new window

0
Comment
Question by:Jing272
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 22676835
I see you are using STL classes too. Why not use std::string class instead?
0
 

Author Comment

by:Jing272
ID: 22682883
string works excellent. Many thanks.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question