Please help, gcc not working

Hi, I am trying to move to Cursor IDE from VSCode. I am on a mac, so the default c++ is clang, but I have installed gcc/g+±14. This works fine in VSCode: it both compiles and the intellisense is g++. In Cursor, while using gcc specific things (such as gnu PBDS), it compiles fine, but the intellisense marks it as red squiggles. The intellisense is set to macos-gcc-arm64.

c_cpp_properties.json:

{
   "configurations": [
       {
           "name": "Mac",
           "includePath": [
               "/opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14",
               "/opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/aarch64-apple-darwin24",
               "/opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/backward",
               "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
           ],
           "defines": [],
           "compilerPath": "/opt/homebrew/Cellar/gcc/14.2.0_1/bin/g++-14",
           "cStandard": "c11",
           "cppStandard": "c++14",
           "intelliSenseMode": "macos-gcc-arm64"
       }
   ],
   "version": 4
}

settings.json:

{
   "github.copilot.enable": {
       "*": true,
       "plaintext": false,
       "markdown": false,
       "scminput": false
   },
   "files.associations": {
       "unordered_set": "cpp"
   }
}

tasks.json:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++ build active file",
            "command": "/opt/homebrew/Cellar/gcc/14.2.0_1/bin/g++-14",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

These all work flawlessly in VSCode.

Thanks in advance!

ETA:

For example, an error it gives is:

[{
"resource": "/Users/**********/Documents/VSCODE/temp/temp.cpp",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "pp_file_not_found",
"severity": 8,
"message": "'bits/stdc++.h' file not found",
"source": "clang",
"startLineNumber": 1,
"startColumn": 10,
"endLineNumber": 1,
"endColumn": 25,
"modelVersionId": 1
}]

which is odd since it shouldn’t be clang… How to fix this?

Hey, Cursor doesn’t use Microsoft IntelliSense for C++ it uses clangd instead. That’s why your c_cpp_properties.json is ignored, and clangd shows errors for GCC-specific headers like bits/stdc++.h.

For GCC projects, you have two options:

  1. Configure clangd to use GCC headers

Create a .clangd file in your project root:

CompileFlags:
  Add:
    - -I/opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14
    - -I/opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/aarch64-apple-darwin24
    - -I/opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/backward

Important: Verify the exact paths for your gcc installation:

ls /opt/homebrew/Cellar/gcc/
g++-14 -v -E -x c++ - < /dev/null

The -v output will show all include paths near the end.

  1. Disable diagnostics (if IntelliSense isn’t critical):
Diagnostics:
  Suppress: '*'

After creating .clangd, reload Cursor (Developer: Reload Window).

Your tasks.json build will work either way this only affects editor diagnostics.

More on clangd: Getting started