dockerqtintellisensevisual-studio-2022docker-container

Intellisense in Visual Studio 2022 with Docker Container does not recognize Qt libraries


I am developing an application on Visual Studio 2022, using docker container. I am using CMakePreset to configure the system and I can open the container successfully and execute and debug the application.

The problem I have is that intellisense does not recognize Qt libraries: all the include clauses say "cannot open source file" and the identifier are not recognized (identifier is undefined). See pictures below.

Include clause "cannot open source file" example

Declaration "identifier is undefined" example

The problem is that the project actually "knows" where they are, because the application can be executed and doesn't give any problem.

At the same time, if I open the container on VS Code with the same dockerfile and CMakePresets, I don't have any issue, and all the Qt classes are recognized by intellisense. See picture below.

vscode intellisense example

What do you suggest?

I have seen online that a solution would involve to update the "VC++ directories" property of the project, but I can't find it, maybe because I am working on a container?!


Solution

  • I have found some other users have also reported the same issue on Github

    As AdamYoblick and bschnurr said:

    Please refer to the linked issue for any updates. This is in our backlog to fix, but we have other tasks with higher priority unfortunately.

    vs 2022 Preview 4 will have a fix when its released

    I think what can be done at the moment is waiting for the issue to be fixed. As a workaround: Try to close the solution in VS and re-open it to see if the issue persists.

    Also you can report this issue at VS forum:

    https://developercommunity.visualstudio.com/VisualStudio/report

    That will allow you to directly interact with the appropriate product group, and make it more convenient for the product group to collect and categorize your issues.

    Docs referred:

    https://github.com/microsoft/PTVS/issues/6713

    https://github.com/microsoft/PTVS/issues/6874

    Hope it can help you.