For example, when writing an NGINX module and needing to include headers from said module, how do I do it?
#include <ngx_core.h>
#include <ngx_http.h>
Naturally, the headers are not found as they don't exist on disk. I doubt the proper way to solve this is to bring in the entire NGINX source's headers just so I can reference the headers in my module.
I'm looking for design-time compiler feedback here, not looking for compile-time supports since the module is built using NGINX's configure
script which handles wiring things up for compilation.
More specifically, how do I resolve this in VS Code without bringing in all the NGINX header files into my src
dir? Is there some sort of symbols file I need?
If I need to have a top-level lib dir with the headers, that's fine, but I cannot change the include paths within my source files (so I couldn't change the include paths to e.g. ../lib/nginx/ngx_core.h
) because this will fail during compile time.
I was able to resolve this by cloning the NGINX repo (and others I needed) and adding include paths to my VS Code config for my project so the C/C++ extension can find them.
.vscode/c_cpp_properties.json
For NGINX, this requires you to download the release/GZip, extract it where you want, and then run
./configure
-- this generates some things/headers inobjs
which are required.