CString format problem and convert with to_string problem

Noah Aas 625 Reputation points
2025-02-28T15:53:01.28+00:00

Hello,

I have an old project and need to develop a new one, and I need to take over code sequences.

Now I get errors with to_string and format.

include xstring.h not helped?

Project is a MFC C++, version 2010

no itag, 28. Februar 2025_11h39m02s_002_

How do I go about getting the definition? What do I have to include?

Is there a good rule?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,867 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 120.1K Reputation points
    2025-02-28T16:24:49.0333333+00:00

    Several forms of to_string require #include <string>.

    If this function is not available, use the CString. For example, if m_nodeIdentifierType is an integer, then: sHelp.Format("NodeIdentifierType %i ... ", Notification.m_NodeId.m_nodeIdentifierType, ....

    The formats are described in documentation.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.