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. Moc file

Moc file

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 3 Posters 652 Views
  • 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.
  • J Offline
    J Offline
    JacobNovitsky
    wrote on last edited by
    #1

    Sometimes when I delete button from QWindow or QDialog, I'm having unexpected errors related to this unexisting button, compiler also points to moc file.
    Also I'm having moc file issues from time to time.
    Usually it helps to recreate new project with new name but its not very convinient
    How to cure it?

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

      Hi,

      How do you remove it ?
      What kind of error do you get ?

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

      J 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        How do you remove it ?
        What kind of error do you get ?

        J Offline
        J Offline
        JacobNovitsky
        wrote on last edited by
        #3

        @SGaist yes, I remove it with AppName-Debug folder
        undefined reference to MainWindow::on_pushButton_8_clicked

        Christian EhrlicherC 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher referenced this topic on
        • J JacobNovitsky

          @SGaist yes, I remove it with AppName-Debug folder
          undefined reference to MainWindow::on_pushButton_8_clicked

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @JacobNovitsky said in Moc file:

          I remove it with AppName-Debug folder

          What does this mean? Do you delete the complete build folder?

          undefined reference to MainWindow::on_pushButton_8_clicked

          The moc file is regenerated as soon as you compile your project and the dependent header changed. I would guess you have another moc_mainwindow.h somewhere around which the compiler is picking up.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          J 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @JacobNovitsky said in Moc file:

            I remove it with AppName-Debug folder

            What does this mean? Do you delete the complete build folder?

            undefined reference to MainWindow::on_pushButton_8_clicked

            The moc file is regenerated as soon as you compile your project and the dependent header changed. I would guess you have another moc_mainwindow.h somewhere around which the compiler is picking up.

            J Offline
            J Offline
            JacobNovitsky
            wrote on last edited by
            #5

            @Christian-Ehrlicher
            I never been concerned about moc file yet
            Now I do and I know almost nothing why do we use it and how to manage it maturely

            I have ~/App with source files dir and ~/App-Debug with MakeFile, corresponding to source files object files and moc + ui source files

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What build system do you use? Make sure there is no moc_* and ui_* in your source directory.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JacobNovitsky
                wrote on last edited by
                #7

                make/qmake
                there is none in my source dir
                its generated on Build and put to ~/App-Debug

                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  What build system do you use?

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  J 1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    What build system do you use?

                    J Offline
                    J Offline
                    JacobNovitsky
                    wrote on last edited by
                    #9

                    @Christian-Ehrlicher make/qmake

                    1 Reply Last reply
                    0
                    • Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by Christian Ehrlicher
                      #10

                      Please show your pro file. Do you have spaces in your path?
                      Also please show the compile of the output of a clean build and then after you modified a header.

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      J 1 Reply Last reply
                      0
                      • Christian EhrlicherC Christian Ehrlicher

                        Please show your pro file. Do you have spaces in your path?
                        Also please show the compile of the output of a clean build and then after you modified a header.

                        J Offline
                        J Offline
                        JacobNovitsky
                        wrote on last edited by
                        #11

                        @Christian-Ehrlicher

                        QT += core gui
                        TEMPLATE = app
                        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                        CONFIG += c++17
                        QMAKE_CXXFLAGS += -O3 # or -O3 for more

                        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 +=
                        DialogManager.cpp
                        main.cpp
                        MainWindow.cpp

                        HEADERS +=
                        DialogManager.h
                        MainWindow.h

                        FORMS +=
                        MainWindow.ui

                        LIBS += -L/home/j/SPL-Debug/debug/debug -lSpl
                        INCLUDEPATH += /home/j/SPL/

                        LIBS += -L/home/j/SML-Debug/debug/debug -lSml
                        INCLUDEPATH += /home/j/SML/

                        INCLUDEPATH += /usr/local/include/opencv4
                        

                        LIBS += -L/usr/local/lib
                        -lopencv_core \

                        Default rules for deployment.

                        qnx: target.path = /tmp/$${TARGET}/bin
                        else: unix:!android: target.path = /opt/$${TARGET}/bin
                        !isEmpty(target.path): INSTALLS += target

                        01:00:23: Configuration unchanged, skipping qmake step.
                        01:00:23: Starting: "/usr/bin/make" -j4
                        clang++ -c -pipe -O3 -g -std=gnu++1z -Wall -Wextra -fPIC -D_REENTRANT -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../App -I. -I../SPL -I../SML -I/usr/local/include/opencv4 -I/usr/local/Qt-6.4.2/include -I/usr/local/Qt-6.4.2/include/QtWidgets -I/usr/local/Qt-6.4.2/include/QtGui -I/usr/local/Qt-6.4.2/include/QtCore -I. -I. -I/usr/local/Qt-6.4.2/mkspecs/linux-clang -o main.o ../App/main.cpp
                        clang++ -ccc-gcc-name g++ -Wl,-rpath,/usr/local/Qt-6.4.2/lib -Wl,-rpath-link,/usr/local/Qt-6.4.2/lib -o App DialogManager.o moc_MainWindow.o -L/home/j/SPL-Debug/debug/debug -lSpl -L/home/j/SML-Debug/debug/debug -lSml -L/usr/local/lib -lopencv_core /usr/local/Qt-6.4.2/lib/libQt6Widgets.so /usr/local/Qt-6.4.2/lib/libQt6Gui.so /usr/local/Qt-6.4.2/lib/libQt6Core.so -lpthread -lGLX -lOpenGL
                        01:00:27: The process "/usr/bin/make" exited normally.
                        01:00:27: Elapsed time: 00:04.

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          JacobNovitsky
                          wrote on last edited by
                          #12

                          any update?

                          1 Reply Last reply
                          0
                          • J Offline
                            J Offline
                            JacobNovitsky
                            wrote on last edited by
                            #13

                            if you just cp ABC to CBA it has no effect
                            If you jump to moc file, then click to missing pushbutton function to go header
                            then delete all functions which cause error
                            its gone

                            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