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. Problem when using array of qstring or vectors of qstring
Forum Updated to NodeBB v4.3 + New Features

Problem when using array of qstring or vectors of qstring

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 857 Views 1 Watching
  • 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.
  • P Offline
    P Offline
    Project try
    wrote on last edited by
    #1

    Hey guys , I had this problem and I couldn't fix it here's the code:

    @
    QString *array_of_Grades; // in header

    array_of_Grades=new QString[9] {"A+,A,B+,B,C+,C,D+,D,F"}; // in imp

    @

    it gives me these errors!

    @
    error: C2143: syntax error : missing ';' before '{'
    error: C2143: syntax error : missing ';' before '}'

    @

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wlinaz
      wrote on last edited by
      #2

      QStringList array_of_Grades;
      array_of_Grades << "A+" << "A" << "B+" << "B" << ...

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mlong
        wrote on last edited by
        #3

        I agree with wlinaz. It's always far best (cleaner, safer, etc.) to use the provided container classes rather than relying on manual C-style arrays or pointer handling.

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply
        0

        • Login

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