Compile active file in VS Code

Sometimes I just want to compile a single file for an nRF Connect project with VS Code and the nRF Connect extension. This sometimes fails because an include file isn't found (for example <app_event_manager_priv.h> included from app_event_manager.h in my case). The file compiles fine when the whole project is built from the nRF Connect extension but not with the 'Compile Active File' function. In the terminal output I see that a lot of '-I<folder>' arguments is given to the 'arm-zephyr-eabi-gcc.exe' compiler but no path covers the <app_event_manager_priv.h> file.

I get the error when the file <app_event_manager.h> is included somewhere in my include hierarchy for a .c file.

Which file or setting do I need to edit to add include paths for the 'Compile Active File' function?

I have added includepaths to the c_cpp_properties.json which works when the whole project is built but these include paths does not seem to be used when running 'Compile Active File'.

The file app_event_manager_priv.h lives in ${workspaceFolder}/nrf/subsys/app_event_manager

Best regards /Ruben

Related