We help IT Professionals succeed at work.

Having trouble using cstring or xstring

tmitch68
tmitch68 asked
on
Hello,

I'm having trouble using both xstring and cstring in a C++ application.  My trouble is that I am able to include the libraries like so:

#include <xstring>
#include <cstring>
using namespace std;

However, I am unable to instantiate an xstring class or a cstring class.  The compiler says they are undeclared identifiers.

Any suggestions?

Thanks in advance,
Tim
Comment
Watch Question

Bill NolanOwner, Lead Technology Programmer

Commented:
Is it a linker error?  (I.e., are you including the proper libraries?)

Can you show both the code that declares and assigns the instances, and the exact error message?
Top Expert 2009
Commented:
<cstring> includes the C style string functionality (http://cplusplus.com/reference/clibrary/cstring/). It does not declare any classes.

<xstring> is non-standard, but assuming you're working in Visual C++, that header should not be included directly by you. Instead, include the standard <string> header, which declares the C++ style std::string class (http://cplusplus.com/reference/string/string/).