Important: Please read the Qt Code of Conduct -

Errors in MVS 2019 when using Qt extension for the first time

  • Hello,

    I am new to Qt programming. I installed Qt 6.1 on my laptop. Moreover, I also installed Qt extension in Microsoft Visual Studio 2019 so that I can write Qt programs. After creating basic Qt Widget Application in MVS 2019, a number of errors have cropped up. For example,

    E1696 cannot open source file "QtWidgets/QApplication"
    E1696 cannot open source file "QtCore/QVariant"
    and so on.

    There are a total of 74 errors. I have specified the path for Qt 6.1 in the Qt options, i.e., Tools --> Options --> Qt --> Versions. I assume the path is ...\Qt\6.1.1\msvc2019_64. But still the errors persist. I am attaching the screenshot of the Visual Studio 2019 setting in this for clarity.

    Kindly, help me regarding this issue.



  • Moderators

    Hi, welcome to the forum.

    You've used a basic console application wizard to create the app. This means it's not set up to use Qt. It's missing include paths, libraries linked, moc and other Qt tools set up for use etc.

    You can set these up manually in this project, but if you're just starting I would suggest to go back to the project creation screen and use one of the Qt application wizards (those are installed with the extension). Just select "Qt" in the project type filter box and use "Qt Widgets Application" wizard. This will create a new basic project with all the Qt related project settings already set up.

Log in to reply