Results 1 to 2 of 2

Thread: qvector in struct and error message

  1. #1
    Join Date
    Apr 2021
    Qt products
    Unix/X11 Windows

    Default qvector in struct and error message

    Hi Guys!
    I have a code,
    i wrote a struct
    and i placed a QVector<T> in it.

    Qt Code:
    1. struct size {
    2. unsigned size,
    3. QVector(uint32_t) vect
    4. };
    To copy to clipboard, switch view to plain text mode 

    error: invalid declarator before ‘vect’
    16 | QVector<unsigned> vect

    Probably need constructor in struct?
    thanks for your help!
    Last edited by thisdave; 9th April 2021 at 17:30.

  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 808 Times in 797 Posts
    Qt products
    Windows Android

    Default Re: qvector in struct and error message

    This is barely C++. Four lines of code, three errors.

    - line 2: A semi-colon, not a comma to end the declaration of "size"
    - line 3: Brackets "<>", not parentheses, when declaring the QVector type.
    - line 3: A semi-colon required to end the declaration of "vect"
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. error: invalid use of incomplete type 'struct QMetaEnum'
    By dyngoman in forum Qt Programming
    Replies: 3
    Last Post: 12th March 2010, 13:38
  2. struct QbufferPrivate error!!
    By chochatown in forum Qt Programming
    Replies: 0
    Last Post: 27th May 2009, 15:37
  3. error: forward declaration of 'struct QPushButton'
    By prykHetQuo in forum Qt Programming
    Replies: 2
    Last Post: 23rd January 2009, 23:20
  4. Replies: 1
    Last Post: 25th October 2008, 19:18


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.