3

I've been wrestling with the .json settings in VS Code for some hours now and I'm pretty lost. All I want to do is link pdcurses to my project so I can start coding. I have intellisense set up, but the #include <curses.h> statement is throwing "curses.h: No such file or directory":

The .jsons:

settings.json:

{
    "files.associations": {
        "iostream": "cpp",
        "vector": "cpp"
    }
}

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\Visual Studio Code Projects\\pdcurs39/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\Mingw-w64\\mingw64\\bin\\g++.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64",
            "forcedInclude": [],
            "browse": {
                "path": []
            }
        }
    ],
    "version": 4
}

tasks.json:

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "build RL Test",
        "type": "shell",
        "command": "g++",
        "args": ["-g", "-o", "RLTest", "RLTest.cpp"],
        "group": {
          "kind": "build",
          "isDefault": true
        }
      }
    ]
  }

launch.json:

    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/RLTest.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\Mingw-w64\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

Normal C++ packages are working fine. pdcurses is installed at C:\Visual Studio Code Projects\pdcurs39\ with a default mingw-w64 make in the wincon folder.

I think the issue is with not including the pdcurses.a file, but I'm not sure how to go about linking that.

starball
  • 20,030
  • 7
  • 43
  • 238
  • The properties file only configures intellisense. You need to add all your compiler settings in your tasks file – Alan Birtles Oct 07 '19 at 07:34
  • The issue is with not finding the header file (curses.h), per the error message. It doesn't get to the linking stage (pdcurses.a). – William McBrine Oct 07 '19 at 21:58
  • I don't see any [include directory flags](https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html) in your build task definition, such as the one you're specifying in your `c_cpp_properties.json` file. I think they're missing. Is the error occurring as a problem indicator in the editor? (if so, it's a.problem with you `c_cpp_properties.json` file) or is the error happening in the terminal/output panel when you run your build task? (if so, it's a problem with your task in your `tasks.json` file). – starball Mar 17 '23 at 07:57

0 Answers0