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. Trouble building Qt
Forum Updated to NodeBB v4.3 + New Features

Trouble building Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 1.0k 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.
  • MassiM Offline
    MassiM Offline
    Massi
    wrote on last edited by
    #1

    pic.png
    Hello
    I ran qmake and try to build the project and I'm getting this. Can anybody explain me why I'm getting this error?

    Software Design Engineer at Ford - Canada

    Pl45m4P 1 Reply Last reply
    0
    • MassiM Massi

      pic.png
      Hello
      I ran qmake and try to build the project and I'm getting this. Can anybody explain me why I'm getting this error?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @Massi

      Try clean and re-build / run qmake again. Alternatively delete build folder.
      That should fix this in most cases.

      Just to be sure: Is your UI from type Ui::MainWindow or Ui::ImageReader? Therefore show your header and your *.pro file please. Also better post code as code block not as image


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      MassiM 1 Reply Last reply
      2
      • Pl45m4P Pl45m4

        @Massi

        Try clean and re-build / run qmake again. Alternatively delete build folder.
        That should fix this in most cases.

        Just to be sure: Is your UI from type Ui::MainWindow or Ui::ImageReader? Therefore show your header and your *.pro file please. Also better post code as code block not as image

        MassiM Offline
        MassiM Offline
        Massi
        wrote on last edited by
        #3

        @Pl45m4 Thanks for your reply! I've tried to clean and rebuild but I got this error

        :-1: error: No rule to make target '/usr/lib/qt5/bin/uic', needed by 'ui_ImageReader.h'.  Stop.
        

        here is my simple code:

        #ifndef IMAGEREADER_H
        #define IMAGEREADER_H
        
        #include <QMainWindow>
        #include <memory>
        
        QT_BEGIN_NAMESPACE
        namespace Ui { class MainWindow; }
        QT_END_NAMESPACE
        
        class MainWindow : public QMainWindow
        {
            Q_OBJECT
        public:
            MainWindow(QWidget *parent = nullptr);
            ~MainWindow() = default;
        
        private:
            std::unique_ptr<Ui::MainWindow> ui;
        };
        #endif // IMAGEREADER_H
        

        cpp:

        #include "ImageReader.h"
        #include "ui_ImageReader.h"
        
        MainWindow::MainWindow(QWidget *parent)
            : QMainWindow(parent)
            , ui(new Ui::MainWindow)
        {
            ui->setupUi(this);
        }
        

        The objectName of the ui is MainWindow

        .pro file

        QT       += core gui
        
        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
        
        CONFIG += c++17
        
        # You can make your code fail to compile if it uses deprecated APIs.
        # In order to do so, uncomment the following line.
        #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
        
        SOURCES += \
            ImageReader.cpp \
            main.cpp
        
        HEADERS += \
            ImageReader.h
        
        FORMS += \
            ImageReader.ui
        
        # Default rules for deployment.
        qnx: target.path = /tmp/$${TARGET}/bin
        else: unix:!android: target.path = /opt/$${TARGET}/bin
        !isEmpty(target.path): INSTALLS += target
        

        Software Design Engineer at Ford - Canada

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Did you just rename the files after having created them ? If so, that is not a good idea.

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

          MassiM 3 Replies Last reply
          1
          • SGaistS SGaist

            Hi,

            Did you just rename the files after having created them ? If so, that is not a good idea.

            MassiM Offline
            MassiM Offline
            Massi
            wrote on last edited by
            #5

            @SGaist Yes I did that, what should it be a problem if you don't mind asking?

            Software Design Engineer at Ford - Canada

            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Did you just rename the files after having created them ? If so, that is not a good idea.

              MassiM Offline
              MassiM Offline
              Massi
              wrote on last edited by
              #6

              @SGaist
              I'm using Ubuntu 20.04 and I have installed qt5, I created a new empty project and I got this error again:

              :-1: error: No rule to make target '/usr/lib/qt5/bin/uic', needed by 'ui_mainwindow.h'.  Stop.
              

              something is wrong with my installation right?

              Software Design Engineer at Ford - Canada

              1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                Did you just rename the files after having created them ? If so, that is not a good idea.

                MassiM Offline
                MassiM Offline
                Massi
                wrote on last edited by
                #7

                @SGaist Get it worked
                that was my problem: https://forum.qt.io/topic/127696/qt-qpa-plugin-could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/28

                Software Design Engineer at Ford - Canada

                SGaistS 1 Reply Last reply
                0
                • MassiM Massi

                  @SGaist Get it worked
                  that was my problem: https://forum.qt.io/topic/127696/qt-qpa-plugin-could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/28

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  That's pretty surprising as the solution you link to is completely unrelated to your original problem.

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

                  MassiM 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    That's pretty surprising as the solution you link to is completely unrelated to your original problem.

                    MassiM Offline
                    MassiM Offline
                    Massi
                    wrote on last edited by
                    #9

                    @SGaist I restarted from scratch, deleted the build folder and created a new project. I ran qmake first and tried to build the project but this time I got this error:

                    qt.qpa.xcb: could not connect to display
                    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
                    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
                    
                    

                    I just installed the xcb dependency and it built correctly. I still dont know/understand why I got the first error with the ui file?

                    Software Design Engineer at Ford - Canada

                    jsulmJ 1 Reply Last reply
                    0
                    • MassiM Massi

                      @SGaist I restarted from scratch, deleted the build folder and created a new project. I ran qmake first and tried to build the project but this time I got this error:

                      qt.qpa.xcb: could not connect to display
                      qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
                      This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
                      
                      

                      I just installed the xcb dependency and it built correctly. I still dont know/understand why I got the first error with the ui file?

                      jsulmJ Online
                      jsulmJ Online
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Massi Set QT_DEBUG_PLUGINS env variable before starting your app and check its output to see why XCB plug-in can't be loaded. Is X server running?

                      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