Moc file
-
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? -
Hi,
How do you remove it ?
What kind of error do you get ? -
-
@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.
-
@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 maturelyI have ~/App with source files dir and ~/App-Debug with MakeFile, corresponding to source files object files and moc + ui source files
-
What build system do you use? Make sure there is no moc_* and ui_* in your source directory.
-
make/qmake
there is none in my source dir
its generated on Build and put to ~/App-Debug -
What build system do you use?
-
@Christian-Ehrlicher make/qmake
-
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 += core gui
TEMPLATE = app
greaterThan(QT_MAJOR_VERSION, 4): QT += widgetsCONFIG += c++17
QMAKE_CXXFLAGS += -O3 # or -O3 for moreYou 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.cppHEADERS +=
DialogManager.h
MainWindow.hFORMS +=
MainWindow.uiLIBS += -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 += target01: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. -
any update?
-
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