The project is starting, but there are problems:

-can't add maktros Q_OBJECT (LNK2001)

- when creating a form (ui) from a template (“Object reference not set to an instance of an object”)

if you add a moc file from a template project to Q_OBJECT does not swear, but a bunch of signals and slots does not work

Need to customize custom build tool

enter image description here

Custom build tool in work program

enter image description here

    1 answer 1

    To work correctly with qt from under msvc, you need to install an addon ( https://download.qt.io/official_releases/vsaddin/ ). After installation, additional menu items will appear in the studio, making it easier to work with QT.

    If you want to create your own class based on QObject (with signals and slots), then you need to create a qt project and add a qt class. When using add-on, options in the "Custom Build Tools" block will be filled automatically.

    project creation class creation

    • I need to connect qt to Visual C ++ -> Empty Project (and not to create a project using a template) - Rater