You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS and Version: macOS Sequoia 15.3 (Apple M3 chip)
VS Code Version: 1.96.4 (Universal)
C/C++ Extension Version: 1.23.5
If using SSH remote, specify OS of remote machine: N/A
Bug Summary and Steps to Reproduce
Bug Summary:
Note: This issue is closely related to #13214. That issue is for Windows, while this is for macOS, but both are related to symlinks. I'd like to open this issue to provide some more info.
The extension cannot find the header files of Homebrew installed packages, even if /opt/homebrew/include is added to includePath.
By default, on Apple silicon machines, Homebrew installs the packages in /opt/homebrew/Cellar, and creates symlinks of the header files in /opt/homebrew/include. Hence, in general, it suffices to add /opt/homebrew/include to includePath. However, the extension is not able to find the symlinked directories, while it is able to find the symlinked files.
Steps to reproduce:
Use brew to install gmp and fmt (just for demonstration, can be any other package like boost, see below)
brew install gmp fmt
Ensure that /opt/homebrew/include contains the header files of gmp and fmt:
Note that /opt/homebrew/include/gmpxx.h is a symlink to a file, and /opt/homebrew/include/fmt is a symlink to a directory. (important)
create and open a new directory in VS Code, and create a file main.cpp with the following content
#include<iostream>
#include<gmpxx.h>// OK
#include<fmt/format.h>// Errorintmain() {
fmt::print("Hello, World!\n");
mpz_class a = 1;
std::cout << a << std::endl;
return0;
}
Create .vscode/c_cpp_properties.json and add /opt/homebrew/include to includePath (see below for the full config file)
Observe that an #include error is reported for the line #include <fmt/format.h> (with red squiggly lines). However, no error for the line #include <gmpxx.h>. Note that both have symlinks in /opt/homebrew/include, but the former is a directory and the latter is a single file. (see Additional Context for screenshot).
However, if I Cmd+Click the line #include <fmt/format.h>, the editor is able to jump to the corresponding file.
To solve the problem, I have to manually add the actual path /opt/homebrew/Cellar/fmt/11.1.3/include to includePath.
Note that the same error exists for libraries that have header files inside a directory, e.g., #include <boost/asio.hpp>, and can be reproduced with the same steps.
Configuration and Logs
Configurations in c_cpp_properties.json
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/opt/homebrew/include"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-arm64"
}
],
"version": 4
}
Logs from running C/C++: Log Diagnostics from the VS Code command palette
-------- Diagnostics - 2025/2/4 22:55:33
Version: 1.23.5
Current Configuration:
{
"name": "Mac",
"includePath": [
"/Users/yuan/projects/test/**",
"/opt/homebrew/include"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-arm64",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"compilerPathInCppPropertiesJson": "/usr/bin/clang",
"mergeConfigurations": false,
"browse": {
"path": [
"/Users/yuan/projects/test/**",
"/opt/homebrew/include",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
Modified Settings:
{
"C_Cpp.loggingLevel": "Debug"
}
Additional Tracked Settings:
{
"editorTabSize": 4,
"editorInsertSpaces": true,
"editorAutoClosingBrackets": "languageDefined",
"filesEncoding": "utf8",
"filesAssociations": {},
"filesExclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
},
"filesAutoSaveAfterDelay": false,
"editorInlayHintsEnabled": true,
"editorParameterHintsEnabled": true,
"searchExclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true
},
"workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.23.5.0
Current database path: /Users/yuan/Library/Caches/vscode-cpptools/c03c8c2de41af61c5fe2b81e358ac6f6/.browse.VC.db
Translation Unit Mappings:
[ /Users/yuan/projects/test/main.cpp - source TU]:
Translation Unit Configurations:
[ /Users/yuan/projects/test/main.cpp ]
Process ID: 29721
Memory Usage: 7 MB
Compiler Path: /usr/bin/clang
Includes:
/opt/homebrew/include
System Includes:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
/Library/Developer/CommandLineTools/usr/lib/clang/16/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include
Frameworks:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks
Standard Version: c++17
IntelliSense Mode: macos-clang-arm64
Other Flags:
--clang
--clang_version=170006
Total Memory Usage: 7 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 26017
Logs from the language server logging: it exceeds the space limit here, so I have attached it in`Other Extensions` field.
Environment
Bug Summary and Steps to Reproduce
Bug Summary:
Note: This issue is closely related to #13214. That issue is for Windows, while this is for macOS, but both are related to symlinks. I'd like to open this issue to provide some more info.
The extension cannot find the header files of Homebrew installed packages, even if
/opt/homebrew/include
is added toincludePath
.By default, on Apple silicon machines, Homebrew installs the packages in
/opt/homebrew/Cellar
, and creates symlinks of the header files in/opt/homebrew/include
. Hence, in general, it suffices to add/opt/homebrew/include
toincludePath
. However, the extension is not able to find the symlinked directories, while it is able to find the symlinked files.Steps to reproduce:
gmp
andfmt
(just for demonstration, can be any other package likeboost
, see below)/opt/homebrew/include
contains the header files ofgmp
andfmt
:and
Note that
/opt/homebrew/include/gmpxx.h
is a symlink to a file, and/opt/homebrew/include/fmt
is a symlink to a directory. (important)main.cpp
with the following content.vscode/c_cpp_properties.json
and add/opt/homebrew/include
toincludePath
(see below for the full config file)#include error
is reported for the line#include <fmt/format.h>
(with red squiggly lines). However, no error for the line#include <gmpxx.h>
. Note that both have symlinks in/opt/homebrew/include
, but the former is a directory and the latter is a single file. (see Additional Context for screenshot).#include <fmt/format.h>
, the editor is able to jump to the corresponding file./opt/homebrew/Cellar/fmt/11.1.3/include
toincludePath
.Note that the same error exists for libraries that have header files inside a directory, e.g.,
#include <boost/asio.hpp>
, and can be reproduced with the same steps.Configuration and Logs
Other Extensions
Logs from the language server logging: language_server_logging.txt
Additional context
The screenshot of the error:
The screenshot of my
/opt/homebrew/include
directoryThe text was updated successfully, but these errors were encountered: