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 C2352: illegal call of non-static member function
Forum Updated to NodeBB v4.3 + New Features

Error C2352: illegal call of non-static member function

Scheduled Pinned Locked Moved General and Desktop
13 Posts 4 Posters 12.9k 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.
  • R Offline
    R Offline
    rraf02
    wrote on last edited by
    #4

    Thanks for the replies.

    I do create an object. I only put in some of the code.

    When I declare in newsurveydialog.h as a static

    static void parseNewSurveyData( QString str );

    I get the following compile errors.

    newsurveydialog.cpp
    .\newsurveydialog.cpp(85) : error C2227: left of '->IDC_EDIT_OUTPUT_RAW' must point to class/struct/union/generic type
    .\newsurveydialog.cpp(85) : error C2227: left of '->append' must point to class/struct/union/generic type
    NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0
    \VC\BIN\cl.EXE"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0
    \VC\BIN\nmake.exe"' : return code '0x2'
    Stop.

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #5

      as i wrote in my post: you are accessing a member (ui) inside this function. Thus you can't make it static.
      Because you can only access other static members out of a static method.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rraf02
        wrote on last edited by
        #6

        Here is the code that creates the ui-> object for ui->IDC_EDIT_OUTPUT_RAW->append( str );

        NewSurveyDialog::NewSurveyDialog(QWidget *parent ) :
        QDialog(parent),
        ui(new Ui::NewSurveyDialog)
        {
        ui->setupUi(this);

        // set flags default values
        m_bNotifyPaused = FALSE;
        //nConnection = NULL;
        
        //connect(ui->buttonOK, SIGNAL(clicked()), SLOT(buttonPressedOK()));
        
        connect(ui->IDC_BUTTON_BROWSE_SAVE_SURVEY, SIGNAL(clicked()), SLOT(buttonPressedBrowseSaveSurvey()));
        
        connect(ui->StartNewSurvey, SIGNAL(clicked()), SLOT(buttonStartNewSurvey()));
        
        connect(ui->PauseAnalysis, SIGNAL(clicked()), SLOT(buttonPauseAnalysis()));
        
        
        //ui->IDC_RSSI_BARGRAPH->setVisible(false);
        
        initProgress(-115,-55);
        
        updateProgress( -115 );
        
        ui->IDC_RSSI_BARGRAPH->setVisible(true);
        
        ui->IDC_EDIT_OUTPUT_RAW->setVisible(true);
        
        ui->IDC_REPEATER_ID->insert( gRptrSerialNbr);
        
        ui->IDC_PARENT_ID->insert( gMasterID );
        
        nonJoinableCount = 0;
        

        }

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rraf02
          wrote on last edited by
          #7

          so how do I pass a data string to newSurveyDialog ?

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #8

            did you read my first post at all? You should use a instance to your object where you want to call the method.
            Or you could use SIGNALS/SLOTS to send a string to another object.

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Mario84
              wrote on last edited by
              #9

              [quote author="rraf02" date="1368194601"]Here is the code that creates the ui-> object for ui->IDC_EDIT_OUTPUT_RAW->append( str );

              NewSurveyDialog::NewSurveyDialog(QWidget *parent ) :
              QDialog(parent),
              ui(new Ui::NewSurveyDialog)
              {
              ui->setupUi(this);

              // set flags default values
              m_bNotifyPaused = FALSE;
              //nConnection = NULL;
              
              //connect(ui->buttonOK, SIGNAL(clicked()), SLOT(buttonPressedOK()));
              
              connect(ui->IDC_BUTTON_BROWSE_SAVE_SURVEY, SIGNAL(clicked()), SLOT(buttonPressedBrowseSaveSurvey()));
              
              connect(ui->StartNewSurvey, SIGNAL(clicked()), SLOT(buttonStartNewSurvey()));
              
              connect(ui->PauseAnalysis, SIGNAL(clicked()), SLOT(buttonPauseAnalysis()));
              
              
              //ui->IDC_RSSI_BARGRAPH->setVisible(false);
              
              initProgress(-115,-55);
              
              updateProgress( -115 );
              
              ui->IDC_RSSI_BARGRAPH->setVisible(true);
              
              ui->IDC_EDIT_OUTPUT_RAW->setVisible(true);
              
              ui->IDC_REPEATER_ID->insert( gRptrSerialNbr);
              
              ui->IDC_PARENT_ID->insert( gMasterID );
              
              nonJoinableCount = 0;
              

              }[/quote]

              That's the code creating an ui-object...
              but the method you're calling isn't a member of the ui-class but of your class NewSurveyDialog
              -> that's the one you have to instantiate and call the method on its instance

              1 Reply Last reply
              0
              • B Offline
                B Offline
                b1gsnak3
                wrote on last edited by
                #10

                in pannel connection.cpp you must create an instance of NewSurveyDialog... For example:

                @
                mData = thread->getData().replace(request.trimmed(), tr(”“)).trimmed();
                qDebug() << “trimmed ==” << mData;

                mData = thread->getData();
                qDebug() << “trimmed ==” << mData;
                NewSurveyDialog *someName = new NewSurveyDialog(); // This is an instance of a object
                somename->parseNewSurveyData(mData); // This is how you call the method for that object
                @

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  rraf02
                  wrote on last edited by
                  #11

                  I'm new at QT and figuring it out as I go, (Reading up and then Trial and Terror).

                  As my brother said when he was posted to Scotland, I know you are speaking english, but I don't understand a word you are saying. :-)

                  I thought I already had an instance already created as I am updating the new window, I just need to pass data to it from the com port data stream.

                  So do you have an example of how I might use SIGNALS/SLOTS to send a string from another object.
                  I will also try to read up on signals/slots.

                  BTW, thanks for the help.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    Mario84
                    wrote on last edited by
                    #12

                    even if you really had created the instance... "NewSurveyDialog::parseNewSurveyData( mData );" is always a static member call

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      rraf02
                      wrote on last edited by
                      #13

                      Thanks. I will give that a try.

                      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