Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

"The program can't start because libgcc_s_seh-1.dll is missing from your computer".



  • Hi guys. I'm making a release build of the following program in qt. My friend made my program into a single file program as an experiment. However, when I build and try to load the executable I get the system error message in the title. The code is like so:

    #include <QApplication>
    #include <QMainWindow>
    #include <QDebug>
    #include <QStandardPaths>
    #include <QTimer>
    #include <QPushButton>
    #include <iostream>
    #include <chrono>
    #include <string>
    #include <fstream>
    #include <QLabel>
    #include <QMenuBar>
    #include <QStatusBar>
    
    
    std::string readTimeFromFile() {
        std::fstream timefile;
        std::string filepath = "C://Users//Byte//Desktop//timelog.txt";
        timefile.open(filepath);
        if(!(timefile.is_open())) {
            qDebug() << "File not opening";
        }
    
        std::string thetime;
        std::getline(timefile, thetime);
        timefile.close();
        return thetime;
    }
    
    class MainWindow : public QMainWindow
    {
    
    public:
        MainWindow(QWidget *parent = nullptr)
            : QMainWindow(parent)
        {
            // Begin setupUi
            if (this->objectName().isEmpty())
                this->setObjectName(QString::fromUtf8("this"));
            this->resize(559, 215);
    
            centralwidget = new QWidget(this);
            centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
    
            // Define startButton
            startButton = new QPushButton(centralwidget);
            startButton->setObjectName(QString::fromUtf8("startButton"));
            startButton->setGeometry(QRect(370, 150, 75, 23));
            connect(startButton, &QPushButton::clicked, [this] { on_startButton_clicked(); });
    
            // Define stopButton
            stopButton = new QPushButton(centralwidget);
            stopButton->setObjectName(QString::fromUtf8("stopButton"));
            stopButton->setGeometry(QRect(460, 150, 75, 23));
            connect(stopButton, &QPushButton::clicked, [this] { on_stopButton_clicked(); });
    
            timeLabel = new QLabel(centralwidget);
            timeLabel->setObjectName(QString::fromUtf8("timeLabel"));
            timeLabel->setGeometry(QRect(20, 30, 501, 101));
            QFont font;
            font.setPointSize(68);
            timeLabel->setFont(font);
            timeLabel->setLayoutDirection(Qt::LeftToRight);
            timeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    
            this->setCentralWidget(centralwidget);
            menubar = new QMenuBar(this);
            menubar->setObjectName(QString::fromUtf8("menubar"));
            menubar->setGeometry(QRect(0, 0, 559, 21));
            this->setMenuBar(menubar);
    
            statusbar = new QStatusBar(this);
            statusbar->setObjectName(QString::fromUtf8("statusbar"));
            this->setStatusBar(statusbar);
    
            //retranslateUi(this); // You're probably not using linguist for translations, but this doesn't hurt anything
    
            //QMetaObject::connectSlotsByName(this);
            // end of setupUi
    
            auto current_time = readTimeFromFile();
            updateTimeLabel(current_time);
    
            connect(&myTimer, &QTimer::timeout, [this] { updateTime();});
        }
    
        void updateTimeLabel(std::string current_time)
        {
            int seconds = stoi(current_time);
            std::string formattedTime;
            int minutes = seconds / 60;
            int hours = minutes / 60;
            seconds %= 60;
            minutes  %= 60;
            formattedTime += std::to_string(hours);
            formattedTime += ":";
            formattedTime += std::to_string(minutes);
            formattedTime += ":";
            formattedTime += std::to_string(seconds);
            QString timeToDisplay = QString::fromStdString(formattedTime);
            timeLabel->setText(timeToDisplay);
        }
    
        void updateTime()
        {
            auto elapsed = std::chrono::system_clock::now() - start;
            auto secondsElapsed = std::chrono::duration_cast<std::chrono::seconds>(elapsed).count();
            std::string current_time = readTimeFromFile();
            int temp = stoi(current_time);
            auto new_time = secondsElapsed += temp;
            updateTimeLabel(std::to_string(new_time));
            qDebug() << "hey";
        }
    
        ~MainWindow()
        {
        }
    
    private:
        // Ui::MainWindow *ui; // Don't need this anymore
    
        void on_startButton_clicked()
        {
            start = std::chrono::system_clock::now();
            // calculate time elapsed, add to file time, update time
             // problem here, connect is not recognising my slot
            myTimer.start();
    
        }
    
        void on_stopButton_clicked()
        {
            myTimer.stop();
        }
    
        QTimer myTimer;
        std::chrono::time_point<std::chrono::high_resolution_clock> start;
        QWidget* centralwidget;
        QPushButton* startButton;
        QPushButton* stopButton;
        QLabel* timeLabel;
        QMenuBar* menubar;
        QStatusBar* statusbar;
    };
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
        return a.exec();
    }
    

    Any ideas?



  • Update: I copied libgcc_s_seh-1.dll into the folder with my .exe in and now it wants libgcc_s_seh-6.dll.



  • @bytebaron said in "The program can't start because libgcc_s_seh-1.dll is missing from your computer".:

    now it wants libgcc_s_seh-6.dll

    loop through all the required libraries until your app starts fine...



  • @pablo-j-rogina Did it. I now get an application error: The application was unable to start correctly (0xc000007b).


  • Lifetime Qt Champion

    @bytebaron Can you run your program from QtCreator?

    Then you need to follow the deploy steps to run it on other computers.

    Regards


Log in to reply