How do I get Visual Studio Code to include non-standard libraries with angle brackets <>?

I am trying to run a program using the ArduinoJson library with the VSC extension Code Runner but I cannot compile it.

There are no markup errors or warnings in VSC but when I try to run this snippet:

#include "../External_Libraries/ArduinoJson/ArduinoJson.h"
#include <iostream>
int main(){
    std::cout << "Done.n";
    return 0;}

I get the error output below:

In file included from ../External_Libraries/ArduinoJson/src/ArduinoJson.hpp:17,
                 from ../External_Libraries/ArduinoJson/src/ArduinoJson.h:9,
                 from ../External_Libraries/ArduinoJson/ArduinoJson.h:5,
                 from localtest.cpp:17: ../External_Libraries/ArduinoJson/src/ArduinoJson/Array/ArrayRef.hpp:7:10: fatal error: ArduinoJson/Array/ArrayFunctions.hpp: No such file or directory
#include <ArduinoJson/Array/ArrayFunctions.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.

Inside the ArduinoJson library, there are some include commands using double quotes and some using angle brackets:

#include "src/ArduinoJson.h"
//...   
#include <ArduinoJson/Array/ArrayFunctions.hpp>

It appears that only the include statements with angle brackets are a problem. I have tried updating my include paths in settings.json as well as in c_cpp_properties.json to cover this, but it has not worked:

In settings.json:

"C_Cpp.default.includePath": [
    "C:...project",
    "C:...projectExternal_LibrariesArduinoJsonsrc",
    "C:...projectExternal_LibrariesArduinoJsonsrcArduinoJsonArray"],
"C_Cpp.default.compilerPath": "C:MinGWbingcc.exe"

In c_cpp_properties.json:

"name": "Win32",
"includePath":[
    "${default}",
    "C:/.../project",
    "C:/.../project/External_Libraries/ArduinoJson/src/ArduinoJson/Array"],
"defines":[
    "_DEBUG",
    "UNICODE",
    "_UNICODE"],
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "windows-gcc-x86",
"compilerPath": "C:/MinGW/bin/gcc.exe",
"compilerArgs": ["-I C:...projectExternal_Libraries"]

Does anyone have any ideas what I might be doing wrong?

My folder structure is

project/
–src/
—-localtest.cpp
–External_Libraries/
—-ArduinoJson/

Source: Windows Questions C++

LEAVE A COMMENT