moc
is a command line tool included with Qt. Typically, the programmer does not interact directly with moc
. Instead, the project Makefile generated by qmake
will specify the needed moc
actions for a given project.
moc
stands for meta-object compiler and must be run on all classes in a project that descend from QObject. The result of running moc
on a class is a new file with prefix moc_
that is pure C++.
moc
is responsible for generating the code for implementing signal and slots, creating the Qt property system, implementing the Qt introspection mechanisms, and/or anything else that's suggested by a class' descending from QObject and using the Q_OBJECT
macro.