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. Compilation issue: aggregate 's_toto reply' has incomplete type and cannot be defined
Forum Updated to NodeBB v4.3 + New Features

Compilation issue: aggregate 's_toto reply' has incomplete type and cannot be defined

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.3k Views 2 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.
  • I Offline
    I Offline
    iTom
    wrote on last edited by
    #1

    Hello everyone ;-)

    I am trying to compile this code but I have very strange issue:
    erreur : aggregate 's_toto reply' has incomplete type and cannot be defined

    It look's like generate a structure which have a incomplete type. I didn't know that thing exist ^^.

    The problem occur when I try to declare "reply" of "s_toto" type which is a structure declared in "MessagesFromClientToServer.h"

    This is my code:
    Client.cpp:

    Client::Client(QTcpSocket * p_client, QObject * parent) : QThread(parent)
    {
        // Declaration
        s_toto reply;
    }
    

    Client.h include "MessagesFromClientToServer.h"

    MessagesFromClientToServer.h:

    // Message from Server to Client to reply the request
    struct {
        unsigned int magic;
        unsigned int type;
        unsigned int server_version;
        unsigned int min_client_version;
        bool client_version_OK;
        bool client_pseudo_OK;
        bool nothing;
        unsigned int stop;
    } toto;
    typedef struct toto s_toto;
    

    My compiler error:

    client.cpp:12:12: error: aggregate 's_toto reply' has incomplete type and cannot be defined s_toto reply;
    

    Have you an idea how to fix it ?

    Thank you in advance ;-)

    kshegunovK jsulmJ 2 Replies Last reply
    0
    • I iTom

      Hello everyone ;-)

      I am trying to compile this code but I have very strange issue:
      erreur : aggregate 's_toto reply' has incomplete type and cannot be defined

      It look's like generate a structure which have a incomplete type. I didn't know that thing exist ^^.

      The problem occur when I try to declare "reply" of "s_toto" type which is a structure declared in "MessagesFromClientToServer.h"

      This is my code:
      Client.cpp:

      Client::Client(QTcpSocket * p_client, QObject * parent) : QThread(parent)
      {
          // Declaration
          s_toto reply;
      }
      

      Client.h include "MessagesFromClientToServer.h"

      MessagesFromClientToServer.h:

      // Message from Server to Client to reply the request
      struct {
          unsigned int magic;
          unsigned int type;
          unsigned int server_version;
          unsigned int min_client_version;
          bool client_version_OK;
          bool client_pseudo_OK;
          bool nothing;
          unsigned int stop;
      } toto;
      typedef struct toto s_toto;
      

      My compiler error:

      client.cpp:12:12: error: aggregate 's_toto reply' has incomplete type and cannot be defined s_toto reply;
      

      Have you an idea how to fix it ?

      Thank you in advance ;-)

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by kshegunov
      #2

      @iTom said in Compilation issue: aggregate 's_toto reply' has incomplete type and cannot be defined:

      Have you an idea how to fix it ?

      My advice is to give a name to your structure. Something like this:

      struct toto {
          // ...
      };
      

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1
      • I iTom

        Hello everyone ;-)

        I am trying to compile this code but I have very strange issue:
        erreur : aggregate 's_toto reply' has incomplete type and cannot be defined

        It look's like generate a structure which have a incomplete type. I didn't know that thing exist ^^.

        The problem occur when I try to declare "reply" of "s_toto" type which is a structure declared in "MessagesFromClientToServer.h"

        This is my code:
        Client.cpp:

        Client::Client(QTcpSocket * p_client, QObject * parent) : QThread(parent)
        {
            // Declaration
            s_toto reply;
        }
        

        Client.h include "MessagesFromClientToServer.h"

        MessagesFromClientToServer.h:

        // Message from Server to Client to reply the request
        struct {
            unsigned int magic;
            unsigned int type;
            unsigned int server_version;
            unsigned int min_client_version;
            bool client_version_OK;
            bool client_pseudo_OK;
            bool nothing;
            unsigned int stop;
        } toto;
        typedef struct toto s_toto;
        

        My compiler error:

        client.cpp:12:12: error: aggregate 's_toto reply' has incomplete type and cannot be defined s_toto reply;
        

        Have you an idea how to fix it ?

        Thank you in advance ;-)

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @iTom To add to @kshegunov : did you include MessagesFromClientToServer.h header file where you're trying to use it?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        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