cvisual-studio-codesymlinkinclude-path

VSCode on Mac arm64 doesn't seem to recognize symlinks in includePath


I am trying to compile/debug a C program with VSCode that I intend to port from Linux to MacOS (Mac Studio). The program uses the arb arbitrary precision library that I installed with homebrew. My program uses 2 include files

#include "acb.h"
#include "flint/profiler.h"

that reside in the /opt/homebrew/include directory. When I first debug the file, I get an error message indicating that these include files were not found. I do the "quick fix" and edit the includePath in the c_cpp_properties.json file adding a line to includePath.

    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "/opt/homebrew/include/**"
            ],

However, I still get the error message 'acb.h' file not found.

All include files in /opt/homebrew/include are symlinks to different locations in /opt/homebrew/Cellar but I thought that shouldn't matter, I have no problems whatsoever compiling the program on the command line using -I/opt/homebrew/include. I also tried "/opt/homebrew/Cellar/**" in the includePath to no avail. I fact, the only way I could get VSCode find my include files was to give their absolute path but even then VSCode couldn't find any include files that were referenced inside acb.h or flint/profiler.h.

Many thanks for any suggestions.


Solution

  • Adding all my command line arguments to the args list in tasks.json solved the problem.