microsoft / microsoft/vscode-cpptools

Qt header files not recognized

Open
#11,769 2 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

investigate: repro
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: macOS 14.1.2
  • VS Code Version: 1.85.0
  • C/C++ Extension Version: v1.18.5
Bug Summary and Steps to Reproduce

Hello,
I have a minimal Qt sample project based on CMake. Qt is installed locally and in my local settings.json I refer to my local Qt installation path:

{
    "cmake.configureArgs": [
        "-DCMAKE_PREFIX_PATH=/Users/stefano/Qt/6.5.1/macos/lib/cmake/"
    ]
}

In CMakeLists.txt I search also for the packages:

find_package(Qt6 COMPONENTS Core REQUIRED)

target_link_libraries(${target} Qt::Core)

It builds successfully (!), but when I open TestClass.h, I get following error message:

'QtCore/qobjectdefs.h' file not found

IDE error

Strangely, I can click with CMD + click into the header file, never the less, VS Code gives me the said error message!

CLion in the other hand does not have this problem.

I have attached my minimal project. I hope, you can help me.

Thanks in advance!

QtSampleProjectFromScratch.zip

lsp-logs.txt

Configuration and Logs
Logs attached in file `lsp-logs.txt`
Other Extensions

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.