Search code examples
gccvisual-studio-codesdl-2ubuntu-20.04

cannot open source file "begin_code.h" (dependency of "SDL2/SDL.h")


When attempting to setup SDL2 with VS Code in Ubuntu 20.01 LTM I get the following VS Code error:

cannot open source file "begin_code.h" (dependency of "SDL2/SDL.h")

Any tips?


Solution

  • Just add "/usr/include/SDL2/" to your c_cpp_properties.json like so:

    {
        "configurations": [
            {
                "name": "Linux",
                "includePath": [
                    "${workspaceFolder}/**",
                    "/usr/include/SDL2/"
                ],
                "defines": [],
                "compilerPath": "/usr/bin/gcc",
                "cStandard": "gnu18",
                "cppStandard": "gnu++14",
                "intelliSenseMode": "gcc-x64"
            }
        ],
        "version": 4
    }