Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error while concatenating using QString.
Forum Updated to NodeBB v4.3 + New Features

Error while concatenating using QString.

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 453 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anuj nogja
    wrote on 15 Feb 2018, 06:52 last edited by
    #1

    Hi All,

    char emp_name[] = "XYZ";
    QString str = "employee name is: "+emp_name;

    When running this code, Error coming is : invalid operand of type const char to binary operator+.

    Kindly suggest how this error can be resolved..

    Regards,
    Anuj

    J 1 Reply Last reply 15 Feb 2018, 07:03
    0
    • A anuj nogja
      15 Feb 2018, 06:52

      Hi All,

      char emp_name[] = "XYZ";
      QString str = "employee name is: "+emp_name;

      When running this code, Error coming is : invalid operand of type const char to binary operator+.

      Kindly suggest how this error can be resolved..

      Regards,
      Anuj

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 15 Feb 2018, 07:03 last edited by
      #2

      @anuj-nogja said in Error while concatenating using QString.:

      Hi All,

      char emp_name[] = "XYZ";
      QString str = "employee name is: "+emp_name;

      When running this code, Error coming is : invalid operand of type const char to binary operator+.

      Kindly suggest how this error can be resolved..

      Regards,
      Anuj

       char emp_name[] = "XYZ";
       QString str = "employee name is: "+QString(emp_name);
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      7

      1/2

      15 Feb 2018, 06:52

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved