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 439 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 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.HilkJ 1 Reply Last reply
    0
    • A anuj nogja

      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.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on 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

      • Login

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