Click here to Skip to main content
15,566,065 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi, I'm new to c++ and I'm working with Embarcadero C++ builder(I have to work with this one).
I need to have a CSting in my code but Whatever library I include, it doesn't work out.
ERROR : Undefined symbol 'CString'
Which library should I include ????

Thanks in advance...
Posted
Updated 2-Jan-22 11:23am

Your development environment doesn't support the Microsoft CString class. If you can't switch to MS Visual C++, then you must either rewrite the code to use a different string class (e.g. std::string) or write your own CString class.
 
Share this answer
 
Comments
CodingLover 21-Sep-11 23:52pm    
The easiest is switch to MS. ;)
add #include <atlstr.h> into your code, will work.
 
Share this answer
 
v4
Comments
lilyNaz 20-Sep-11 2:16am    
Well I've added this one but then after compile : ERROR Unable to open include file 'atlstr.h'
CodingLover 20-Sep-11 2:23am    
That means you don't have ATL. Can provide more details like, is this Console or WinForm application? Working on Windows or Linux? Using Visual Studio? etc...
CodingLover 20-Sep-11 2:34am    
If you are working with Visual Studio express edition, sorry about that. Express edition doesn't come with ATL.
merano99 2-Jan-22 19:54pm    
MFC and ATL are both included in the free Visual-Studio Community Edition.
I can't say whether the atlstr.h could be used with a compiler other than Visual-Studio. You will surely be able to look at the headers.
(By the way: Fortunately, the times of the cropped express versions are over.)
lilyNaz 20-Sep-11 2:39am    
It is a Console Application, and is working on Windows 7, I am using Embarcadero C++ builder.
I found this question while looking for an answer to a similar problem. If MFC isn't installed and since your program is a Console app, its better using CAtlString instead of CString.
 
Share this answer
 
Comments
merano99 2-Jan-22 20:02pm    
In atlstr.h you will find:

Line 1296 - typedef CAtlString CString;

so why not use CString?
CHill60 4-Jan-22 4:03am    
And why is it better?
Michael Haephrati 4-Jan-22 8:21am    
It solved issues in the past, especially when CString was used as part of a non MFC project. Some CString member functions as slightly different between the MFC version and the ATL one, so when ATL is used, such conflicts are avoided.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900