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. [Solved]Project suddenly doesn't compile
Forum Updated to NodeBB v4.3 + New Features

[Solved]Project suddenly doesn't compile

Scheduled Pinned Locked Moved General and Desktop
qtcreator
13 Posts 3 Posters 4.7k 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.
  • G Offline
    G Offline
    Gillou_beginqt
    wrote on last edited by Gillou_beginqt
    #1

    I am working on project right now. For two days I took a break and didn't work on my project. After those two days I compiled my program who was working before and now I got errors from classes I didn't even use. During those two days no changes had been made to the code

    Code

    #ifndef NEWSALEPANEL_H
    #define NEWSALEPANEL_H
    
    #include <QWidget>
    #include "abstractpanel.h"
    #include "ui_newsalepanel.h"
    #include <QSqlRelationalTableModel>
    #include <QDataWidgetMapper>
    
    class NewSalePanel;
    
    
    class NewSalePanel : public AbstractPanel
    {
        Q_OBJECT
    
    public:
        static NewSalePanel *instance();
        void showPanel(int NewSaleIndex);
    
    public slots:
        void savedClicked();
    
    private:
        Ui::NewSalePanel ui;
        NewSalePanel();
        static NewSalePanel *m_instance;
        int m_currentIndex;
        QSqlRelationalTableModel *customer;
        QDataWidgetMapper *mapper;
    
    #endif // NEWSALEPANEL_H
    

    #include "newsalepanel.h"
    #include "ui_newsalepanel.h"
    #include "panelstack.h"
    #include <QGridLayout>
    #include <QSqlQuery>
    #include <QtSql>
    #include <QMessageBox>
    #include <QSqlRelationalTableModel>
    #include <QDataWidgetMapper>

    int order=1;
    int product=1;
    int bill=1;
    QString customer_sale;

    NewSalePanel *NewSalePanel::m_instance = 0;
    NewSalePanel *NewSalePanel::instance()
    {
    if(!m_instance)
    {
    m_instance= new NewSalePanel();
    m_instance->addPanelToStack();
    }
    return m_instance;

    }
    void NewSalePanel::showPanel(int saleIndex)
    {
    m_currentIndex=saleIndex;

    PanelStack::instance()->showPanel(panelIndex());
    

    }

    NewSalePanel::NewSalePanel() :AbstractPanel()

    {
    ui.setupUi(this);

    connect(ui.backButton,SIGNAL(clicked()),PanelStack::instance(),SLOT(back()));
    connect(ui.createButton,SIGNAL(clicked()),SLOT(savedClicked()));
    customer = new QSqlRelationalTableModel(this);
    customer->setTable("orders");
    customer->setRelation(saleCustomerId,QSqlRelation("customerdetails","customerID","name"));
    customer->select();
    

    //customerID =customer->fieldIndex("customerID");
    QSqlTableModel *relModel = purchase->relationModel(saleCustomerId);
    ui.customer->setModel(relModel);
    ui.customer->setModelColumn(relModel->fieldIndex("name"));

     mapper = new QDataWidgetMapper(this);
     mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
     mapper->setItemDelegate(new QSqlRelationalDelegate(this));
     mapper->setModel(customer);
     mapper->addMapping(ui.customer,saleCustomerId);
    

    }

    void NewSalePanel::savedClicked()
    {
    QSqlQuery query,query1,query2;
    QString amount,date,invoice_number,qty,uPrice,desc,order_id,product_id,bill_no;
    amount=ui.amount_1->text();
    date= ui.issueDate->text();
    invoice_number=ui.referenceNumber->text();
    qty=ui.qty->text();
    uPrice=ui.unitPrice->text();
    desc=ui.description->toPlainText();
    order_id=QString::number(order);
    product_id=QString::number(product);
    bill_no=QString::number(bill);

    /*query.prepare("INSERT INTO order_detail(orderDetail_id,invoice_date,qty,unit_price,description,order_id,product_id,bill_no)"
                  "VALUES('"+invoice_number+"','"+date+"','"+qty+"','"+uPrice+"','"+desc+"','"+order_id+"','"+product_id+"','"+bill_no+"')");
    

    */

    if(query.exec())
    {
    
        QMessageBox::information(this,"Save","Details saved");
        order++;
        product++;
        bill++;
    
    
    
    }
    else
    {
    
         QMessageBox::critical(this,"Error",query.lastError().text());
    
    
    }
    

    }

    
    Compile Output
    
    02:43:54: Running steps for project Final_Project...
    02:43:54: Configuration unchanged, skipping qmake step.
    02:43:54: Starting: "C:\Qt1\Tools\mingw492_32\bin\mingw32-make.exe" -f Makefile.Debug debug/newsalepanel.o
    g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\Final_Project -I. -IC:\Qt1\5.5\mingw492_32\include -IC:\Qt1\5.5\mingw492_32\include\QtWidgets -IC:\Qt1\5.5\mingw492_32\include\QtGui -IC:\Qt1\5.5\mingw492_32\include\QtANGLE -IC:\Qt1\5.5\mingw492_32\include\QtSql -IC:\Qt1\5.5\mingw492_32\include\QtCore -Idebug -I. -IC:\Qt1\5.5\mingw492_32\mkspecs\win32-g++  -o debug\newsalepanel.o ..\Final_Project\newsalepanel.cpp
    In file included from C:\Qt1\5.5\mingw492_32\include\QtCore/QStack:1:0,
                     from ..\Final_Project\panelstack.h:6,
                     from ..\Final_Project\newsalepanel.cpp:3:
    C:\Qt1\5.5\mingw492_32\include\QtCore/qstack.h:56:25: error: cannot define member function 'NewSalePanel::QStack<T>::pop' within 'NewSalePanel'
     inline T QStack<T>::pop()
                             ^
    C:\Qt1\5.5\mingw492_32\include\QtCore/qstack.h:61:26: error: cannot define member function 'NewSalePanel::QStack<T>::top' within 'NewSalePanel'
     inline T &QStack<T>::top()
                              ^
    C:\Qt1\5.5\mingw492_32\include\QtCore/qstack.h:65:34: error: cannot define member function 'NewSalePanel::QStack<T>::top' within 'NewSalePanel'
     inline const T &QStack<T>::top() const
                                      ^
    In file included from C:\Qt1\5.5\mingw492_32\include/QtCore/qglobal.h:1098:0,
                     from C:\Qt1\5.5\mingw492_32\include/QtGui/qwindowdefs.h:37,
                     from C:\Qt1\5.5\mingw492_32\include\QtWidgets/qwidget.h:37,
                     from C:\Qt1\5.5\mingw492_32\include\QtWidgets/QWidget:1,
                     from ..\Final_Project\newsalepanel.h:4,
                     from ..\Final_Project\newsalepanel.cpp:1:
    C:\Qt1\5.5\mingw492_32\include/QtCore/qtypeinfo.h:188:10: error: explicit specialization in non-namespace scope 'class NewSalePanel'
     template<> \
              ^
    C:\Qt1\5.5\mingw492_32\include/QtCore/qeasingcurve.h:122:1: note: in expansion of macro 'Q_DECLARE_TYPEINFO'
     Q_DECLARE_TYPEINFO(QEasingCurve, Q_MOVABLE_TYPE);
     ^
    C:\Qt1\5.5\mingw492_32\include/QtCore/qtypeinfo.h:172:7: error: specialization of 'template<class T> class QTypeInfo' must appear at namespace scope
     class QTypeInfo<TYPE > \
           ^
    C:\Qt1\5.5\mingw492_32\include/QtCore/qtypeinfo.h:189:1: note: in expansion of macro 'Q_DECLARE_TYPEINFO_BODY'
     Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS)
     ^
    C:\Qt1\5.5\mingw492_32\include/QtCore/qeasingcurve.h:122:1: note: in expansion of macro 'Q_DECLARE_TYPEINFO'
     Q_DECLARE_TYPEINFO(QEasingCurve, Q_MOVABLE_TYPE);
     ^
    In file included from C:\Qt1\5.5\mingw492_32\include/QtCore/qvariantanimation.h:37:0,
                     from C:\Qt1\5.5\mingw492_32\include/QtCore/qpropertyanimation.h:37,
                     from C:\Qt1\5.5\mingw492_32\include/QtCore/QtCore:8,
                     from C:\Qt1\5.5\mingw492_32\include/QtSql/QtSqlDepends:3,
                     from C:\Qt1\5.5\mingw492_32\include\QtSql/QtSql:3,
                     from ..\Final_Project\newsalepanel.cpp:6:
    C:\Qt1\5.5\mingw492_32\include/QtCore/qeasingcurve.h:125:71: error: 'QDebug NewSalePanel::operator<<(QDebug, const NewSalePanel::QEasingCurve&)' must take exactly one argument
     Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item);
                                                                           ^
    C:\Qt1\5.5\mingw492_32\include/QtCore/qeasingcurve.h:129:73: error: 'QDataStream& NewSalePanel::operator<<(QDataStream&, const NewSalePanel::QEasingCurve&)' must take exactly one argument
     Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve&);
                                                                             ^
    C:\Qt1\5.5\mingw492_32\include/QtCore/qeasingcurve.h:130:68: error: 'QDataStream& NewSalePanel::operator>>(QDataStream&, NewSalePanel::QEasingCurve&)' must take exactly one argument
     Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
                                                                        ^
    In file included from C:\Qt1\5.5\mingw492_32\include/QtCore/qpropertyanimation.h:37:0,
                     from C:\Qt1\5.5\mingw492_32\include/QtCore/QtCore:8,
                     from C:\Qt1\5.5\mingw492_32\include/QtSql/QtSqlDepends:3,
                     from C:\Qt1\5.5\mingw492_32\include\QtSql/QtSql:3,
                     from ..\Final_Project\newsalepanel.cpp:6:
    C:\Qt1\5.5\mingw492_32\include/QtCore/qvariantanimation.h:109:6: error: too many template-parameter-lists
     void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress)) {
          ^
    In file included from C:\Qt1\5.5\mingw492_32\include/QtCore/QtCore:9:0,
                     from C:\Qt1\5.5\mingw492_32\include/QtSql/QtSqlDepends:3,
                     from C:\Qt1\5.5\mingw492_32\include\QtSql/QtSql:3,
                     from ..\Final_Project\newsalepanel.cpp:6:
    C:\Qt1\5.5\mingw492_32\include/QtCore/qsequentialanimationgroup.h:44:7: error: 'NewSalePanel::QPauseAnimation' is not a template type
     class QPauseAnimation;
           ^
    C:\Qt1\5.5\mingw492_32\include/QtCore/qsequentialanimationgroup.h:47:21: error: 'NewSalePanel::QSequentialAnimationGroup' is not a template type
     class Q_CORE_EXPORT QSequentialAnimationGroup : public QAnimationGroup
                         ^
    C:\Qt1\5.5\mingw492_32\include/QtCore/qsequentialanimationgroup.h:49:20: error: expected unqualified-id before end of line
         Q_OBJECT
                        ^
    C:\Qt1\5.5\mingw492_32\include/QtCore/qsequentialanimationgroup.h:49:20: error: expected '}' before end of line
    C:\Qt1\5.5\mingw492_32\include/QtCore/qsequentialanimationgroup.h:49:20: error: expected unqualified-id before end of line
    C:\Qt1\5.5\mingw492_32\include/QtCore/qsequentialanimationgroup.h:49:20: error: expected declaration before end of line
    Makefile.Debug:6382: recipe for target 'debug/newsalepanel.o' failed
    mingw32-make: *** [debug/newsalepanel.o] Error 1
    02:43:56: The process "C:\Qt1\Tools\mingw492_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project Final_Project (kit: Desktop Qt 5.5.1 MinGW 32bit)
    When executing step "Make"
    02:43:56: Elapsed time: 00:02.
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I'd check that your Qt headers haven't been modified by e.g. a hasty search/replace.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gillou_beginqt
        wrote on last edited by
        #3

        From what I know my Qt Hearders haven't been modified. What is the issue then?

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

          Hi if you compile in Release mode do you get the same errors?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Gillou_beginqt
            wrote on last edited by
            #5

            Yes exactly the same in release mode

            1 Reply Last reply
            0
            • hskoglundH Offline
              hskoglundH Offline
              hskoglund
              wrote on last edited by
              #6

              Hi, do you have the code for panelstack.h?

              1 Reply Last reply
              0
              • G Offline
                G Offline
                Gillou_beginqt
                wrote on last edited by Gillou_beginqt
                #7

                Here the code

                #ifndef PANELSTACK_H
                #define PANELSTACK_H
                
                #include <QWidget>
                #include <QLabel>
                #include <QStack>
                #include <QStackedWidget>
                #include "abstractpanel.h"
                
                class PanelStack : public QWidget
                {
                    Q_OBJECT
                public:
                
                     static PanelStack *instance();
                
                     int addPanel( AbstractPanel* );
                     void showPanel( int );
                     PanelStack();
                
                
                public slots:
                     void home();
                     void back();
                
                private:
                
                     static PanelStack *m_instance;
                
                     void showTopPanel();
                
                   //  QLabel *m_titleLabel;
                
                     QStackedWidget *m_panelStack;
                     QStack<int> m_history;
                
                };
                
                #endif // PANELSTACK_H
                
                
                #include "panelstack.h"
                #include "abstractpanel.h"
                #include <QStackedWidget>
                #include <QGridLayout>
                
                
                PanelStack *PanelStack::m_instance = 0;
                PanelStack *PanelStack::instance()
                {
                    if( !m_instance )
                        m_instance = new PanelStack();
                
                    return m_instance;
                }
                
                int PanelStack::addPanel( AbstractPanel *panel )
                {
                    return m_panelStack->addWidget( panel );
                }
                
                void PanelStack::showPanel( int index )
                {
                    m_history.push( index );
                    showTopPanel();
                }
                
                void PanelStack::showTopPanel()
                {
                    m_panelStack->setCurrentIndex( m_history.top() );
                    AbstractPanel *panel = dynamic_cast<AbstractPanel*>( m_panelStack->widget( m_history.top() ) );
                
                    panel->enterPanel();
                   // m_titleLabel->setText( panel->titleText() );
                }
                
                PanelStack::PanelStack() : QWidget()
                {
                    //m_titleLabel = new QLabel();
                    //m_titleLabel->setAlignment( Qt::AlignCenter );
                    m_panelStack = new QStackedWidget();
                
                    QGridLayout *layout = new QGridLayout( this );
                    //layout->addWidget( m_titleLabel, 0, 0 );
                    layout->addWidget( m_panelStack, 1, 0 );
                }
                
                void PanelStack::back()
                {
                    if( m_history.count() <= 1 )
                        return; // Cannot go back past the first panel
                
                    m_history.pop();
                
                    showTopPanel();
                }
                
                
                void PanelStack::home()
                {
                    if( m_history.count() <= 1 )
                        return; // Cannot go home if there are no panels, and is already home if there is only one panel
                
                    while( m_history.count() > 1 )
                        m_history.pop();
                
                    showTopPanel();
                }
                
                
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Did you check the content of QStack.h ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    Gillou_beginqt
                    wrote on last edited by
                    #9

                    I did check the content of Qstack.h

                    QStack.h

                    /****************************************************************************
                    **
                    ** Copyright (C) 2015 The Qt Company Ltd.
                    ** Contact: http://www.qt.io/licensing/
                    **
                    ** This file is part of the QtCore module of the Qt Toolkit.
                    **
                    ** $QT_BEGIN_LICENSE:LGPL21$
                    ** Commercial License Usage
                    ** Licensees holding valid commercial Qt licenses may use this file in
                    ** accordance with the commercial license agreement provided with the
                    ** Software or, alternatively, in accordance with the terms contained in
                    ** a written agreement between you and The Qt Company. For licensing terms
                    ** and conditions see http://www.qt.io/terms-conditions. For further
                    ** information use the contact form at http://www.qt.io/contact-us.
                    **
                    ** GNU Lesser General Public License Usage
                    ** Alternatively, this file may be used under the terms of the GNU Lesser
                    ** General Public License version 2.1 or version 3 as published by the Free
                    ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
                    ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
                    ** following information to ensure the GNU Lesser General Public License
                    ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
                    ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
                    **
                    ** As a special exception, The Qt Company gives you certain additional
                    ** rights. These rights are described in The Qt Company LGPL Exception
                    ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
                    **
                    ** $QT_END_LICENSE$
                    **
                    ****************************************************************************/
                    
                    #ifndef QSTACK_H
                    #define QSTACK_H
                    
                    #include <QtCore/qvector.h>
                    
                    QT_BEGIN_NAMESPACE
                    
                    
                    template<class T>
                    class QStack : public QVector<T>
                    {
                    public:
                        inline QStack() {}
                        inline ~QStack() {}
                        inline void swap(QStack<T> &other) { QVector<T>::swap(other); } // prevent QVector<->QStack swaps
                        inline void push(const T &t) { QVector<T>::append(t); }
                        T pop();
                        T &top();
                        const T &top() const;
                    };
                    
                    template<class T>
                    inline T QStack<T>::pop()
                    { Q_ASSERT(!this->isEmpty()); T t = this->data()[this->size() -1];
                      this->resize(this->size()-1); return t; }
                    
                    template<class T>
                    inline T &QStack<T>::top()
                    { Q_ASSERT(!this->isEmpty()); this->detach(); return this->data()[this->size()-1]; }
                    
                    template<class T>
                    inline const T &QStack<T>::top() const
                    { Q_ASSERT(!this->isEmpty()); return this->data()[this->size()-1]; }
                    
                    QT_END_NAMESPACE
                    
                    #endif // QSTACK_H
                    
                    
                    
                    
                    1 Reply Last reply
                    0
                    • hskoglundH Offline
                      hskoglundH Offline
                      hskoglund
                      wrote on last edited by
                      #10

                      Sorry need abstractpanel.h also..

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        Gillou_beginqt
                        wrote on last edited by Gillou_beginqt
                        #11

                        Abstract Panel

                        #ifndef ABSTRACTPANEL_H
                        #define ABSTRACTPANEL_H
                        
                        #include <QWidget>
                        
                        class AbstractPanel:public QWidget
                        {
                        public:
                            virtual void enterPanel() {}
                            //virtual QString titleText() const = 0;
                        
                        protected:
                            AbstractPanel();
                        
                            void addPanelToStack();
                            int panelIndex() const;
                        
                        private:
                            int m_panelIndex;
                        };
                        
                        #endif // ABSTRACTPANEL_H
                        
                        #include "abstractpanel.h"
                        #include "panelstack.h"
                        
                        AbstractPanel::AbstractPanel():QWidget()
                        {
                        
                        }
                        
                        void AbstractPanel::addPanelToStack()
                        {
                            m_panelIndex = PanelStack::instance()->addPanel( this );
                        }
                        
                        int AbstractPanel::panelIndex() const
                        {
                            return m_panelIndex;
                        }
                        
                        
                        1 Reply Last reply
                        0
                        • hskoglundH Offline
                          hskoglundH Offline
                          hskoglund
                          wrote on last edited by
                          #12

                          Hi, hmmm files look ok, but just checking:
                          Almost at the end of newsalepanel.h I don't see any }; I mean shouldn't it be:

                          ...
                          
                              QDataWidgetMapper *mapper;
                          }; 
                          
                          #endif // NEWSALEPANEL_H
                          
                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            Gillou_beginqt
                            wrote on last edited by
                            #13

                            Thank you. I have found the error. I've missed a bracket and a semi colon in one of my header file

                            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