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. First define here
Forum Updated to NodeBB v4.3 + New Features

First define here

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.2k 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.
  • M Offline
    M Offline
    Mr_Steve
    wrote on last edited by
    #1

    Good morning. I have such a problem...

    MinGw:

    ./build\help.o:help.cpp:(.text+0x0): multiple definition of `Help::Help(QWidget*)'
    ./build\help.o:help.cpp:(.text+0x0): first defined here
    ./build\help.o:help.cpp:(.text+0x0): multiple definition of `Help::Help(QWidget*)'
    ./build\help.o:help.cpp:(.text+0x0): first defined here
    ./build\help.o:help.cpp:(.text+0x180): multiple definition of `Help::~Help()'
    ./build\help.o:help.cpp:(.text+0x180): first defined here
    ./build\help.o:help.cpp:(.text+0x1b0): multiple definition of `non-virtual thunk to Help::~Help()'
    ./build\help.o:help.cpp:(.text+0x1b0): first defined here
    ./build\help.o:help.cpp:(.text+0x180): multiple definition of `Help::~Help()'
    ./build\help.o:help.cpp:(.text+0x180): first defined here
    ./build\help.o:help.cpp:(.text+0x1c0): multiple definition of `Help::~Help()'
    ./build\help.o:help.cpp:(.text+0x1c0): first defined here
    ./build\help.o:help.cpp:(.text+0x1e0): multiple definition of `non-virtual thunk to Help::~Help()'
    ./build\help.o:help.cpp:(.text+0x1e0): first defined here
    ./build\help.o:help.cpp:(.text+0x1f0): multiple definition of `Help::begin() const'
    ./build\help.o:help.cpp:(.text+0x1f0): first defined here
    ./build\help.o:help.cpp:(.text+0x210): multiple definition of `Help::end() const'
    ./build\help.o:help.cpp:(.text+0x210): first defined here
    C:/Qt/Qt5.4.1/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: ./build\help.o: bad reloc address 0x18 in section `.text$_ZN7Ui_Help7setupUiEP7QDialog[__ZN7Ui_Help7setupUiEP7QDialog]'
    collect2.exe: error: ld returned 1 exit status
    make[1]: *** [Makefile.Release:310: release\sosp.exe] Error 1
    

    My help.cpp:

    #include "help.h"
     
    #include <ui_help.h>
     
    Help::Help(QWidget *parent)
        : QDialog(parent)
        , ui(new Ui::Help)
    {
        ui->setupUi(this);
     
        ui->beginDE->setMaximumDate( QDateTime::currentDateTime().date() );  //два dateEdit 
        ui->beginDE->setDate( QDateTime::currentDateTime().date() );
     
        ui->endDE->setMaximumDate( QDateTime::currentDateTime().date() );
        ui->endDE->setDate( QDateTime::currentDateTime().date() );
    }
     
    Help::~Help()
    {
        delete ui;
    }
     
    QDate Help::begin() const
    {
        return ui->beginDE->date();
    }
     
    QDate Help::end() const
    {
        return ui->endDE->date();
    }
    
    My help.h:
    
    
    #pragma once
     
    #include <QDialog>
    #include <QDateTime>
     
    namespace Ui { class Help; }
     
    class Help : public QDialog
    {
        Q_OBJECT
    public:
        explicit Help(QWidget *parent = 0);
        ~Help();
     
        QDate begin() const;
        QDate end() const;
     
    private:
        Ui::Help * ui;
    };
    

    Main.cpp functional:

    void MainWindow::view_help()
    {
        if ( !checkPwd() ) return;
     
       Help * dialog = new Help( this );
        if ( dialog->exec() )
        {
            CrewTableViewerWidget * viewer = new CrewTableViewerWidget(this);
            viewer->setConfig( _editorConfig );
            viewer->setTimeInterval( dialog->begin(), dialog->end() );
            viewer->setCrew( getCrewIndex() );
            viewer->show();
        }
        dialog->deleteLater();
    }
    

    Also, there are .h and .cpp files that have the same functionality, but they work well.
    What could be the problem?

    aha_1980A 1 Reply Last reply
    0
    • M Mr_Steve

      Good morning. I have such a problem...

      MinGw:

      ./build\help.o:help.cpp:(.text+0x0): multiple definition of `Help::Help(QWidget*)'
      ./build\help.o:help.cpp:(.text+0x0): first defined here
      ./build\help.o:help.cpp:(.text+0x0): multiple definition of `Help::Help(QWidget*)'
      ./build\help.o:help.cpp:(.text+0x0): first defined here
      ./build\help.o:help.cpp:(.text+0x180): multiple definition of `Help::~Help()'
      ./build\help.o:help.cpp:(.text+0x180): first defined here
      ./build\help.o:help.cpp:(.text+0x1b0): multiple definition of `non-virtual thunk to Help::~Help()'
      ./build\help.o:help.cpp:(.text+0x1b0): first defined here
      ./build\help.o:help.cpp:(.text+0x180): multiple definition of `Help::~Help()'
      ./build\help.o:help.cpp:(.text+0x180): first defined here
      ./build\help.o:help.cpp:(.text+0x1c0): multiple definition of `Help::~Help()'
      ./build\help.o:help.cpp:(.text+0x1c0): first defined here
      ./build\help.o:help.cpp:(.text+0x1e0): multiple definition of `non-virtual thunk to Help::~Help()'
      ./build\help.o:help.cpp:(.text+0x1e0): first defined here
      ./build\help.o:help.cpp:(.text+0x1f0): multiple definition of `Help::begin() const'
      ./build\help.o:help.cpp:(.text+0x1f0): first defined here
      ./build\help.o:help.cpp:(.text+0x210): multiple definition of `Help::end() const'
      ./build\help.o:help.cpp:(.text+0x210): first defined here
      C:/Qt/Qt5.4.1/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: ./build\help.o: bad reloc address 0x18 in section `.text$_ZN7Ui_Help7setupUiEP7QDialog[__ZN7Ui_Help7setupUiEP7QDialog]'
      collect2.exe: error: ld returned 1 exit status
      make[1]: *** [Makefile.Release:310: release\sosp.exe] Error 1
      

      My help.cpp:

      #include "help.h"
       
      #include <ui_help.h>
       
      Help::Help(QWidget *parent)
          : QDialog(parent)
          , ui(new Ui::Help)
      {
          ui->setupUi(this);
       
          ui->beginDE->setMaximumDate( QDateTime::currentDateTime().date() );  //два dateEdit 
          ui->beginDE->setDate( QDateTime::currentDateTime().date() );
       
          ui->endDE->setMaximumDate( QDateTime::currentDateTime().date() );
          ui->endDE->setDate( QDateTime::currentDateTime().date() );
      }
       
      Help::~Help()
      {
          delete ui;
      }
       
      QDate Help::begin() const
      {
          return ui->beginDE->date();
      }
       
      QDate Help::end() const
      {
          return ui->endDE->date();
      }
      
      My help.h:
      
      
      #pragma once
       
      #include <QDialog>
      #include <QDateTime>
       
      namespace Ui { class Help; }
       
      class Help : public QDialog
      {
          Q_OBJECT
      public:
          explicit Help(QWidget *parent = 0);
          ~Help();
       
          QDate begin() const;
          QDate end() const;
       
      private:
          Ui::Help * ui;
      };
      

      Main.cpp functional:

      void MainWindow::view_help()
      {
          if ( !checkPwd() ) return;
       
         Help * dialog = new Help( this );
          if ( dialog->exec() )
          {
              CrewTableViewerWidget * viewer = new CrewTableViewerWidget(this);
              viewer->setConfig( _editorConfig );
              viewer->setTimeInterval( dialog->begin(), dialog->end() );
              viewer->setCrew( getCrewIndex() );
              viewer->show();
          }
          dialog->deleteLater();
      }
      

      Also, there are .h and .cpp files that have the same functionality, but they work well.
      What could be the problem?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Mr_Steve make sure help.cpp is not added multiple times to your .pro file

      Regards

      Qt has to stay free or it will die.

      M 1 Reply Last reply
      4
      • aha_1980A aha_1980

        @Mr_Steve make sure help.cpp is not added multiple times to your .pro file

        Regards

        M Offline
        M Offline
        Mr_Steve
        wrote on last edited by
        #3

        @aha_1980 Thanks! It-s work.

        Pablo J. RoginaP 1 Reply Last reply
        1
        • M Mr_Steve

          @aha_1980 Thanks! It-s work.

          Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #4

          @Mr_Steve is your issue solved? If so please don't forget to mark your post as such. Thanks.

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          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