Local compile doesn't find header file

Hi there,

I use Visual Studio Code to write firmware for an ESP8266 (with Platformio) and a Photon (with Particle Workbench).

I wrote several wrapping library for the ESP8266 and now I’m tring to use it also for the Photon.
I use the ifdef statement to include low level libraries for each target.

My idea is to mantain the same project structure for both projects.

This is the program structure for ESP8266:

The lib folder includes libraries downloaded from internet (ESP8266)
The include folder includes the header file for my wrapping functions
The src folder includes the cpp file for my wrapping function and the main file.

I want to use the same structure for my Particle project:


The lib filder includes the libraries downloaded from internet through particle CLI
The include and src folder include the header and source file for my wrapping libraries.

When I try to compile the project locally I get this error:

/src/mqtt_interface.cpp:31:38: fatal error: include\mqtt_interface.h: No such file or directory

I included the header file “mqtt_interface.h” with

#include "include\mqtt_interface.h"

Did I something wrong?

Thanks in advance for the help.

Best regards,

That include directory needs to reside inside the src folder for your project.
Only src and lib (and it’s descendants) are used by the default make file.

Hi @ScruffR,

thanks for the reply.

Is there a way to move include folder outside from src folder?


When you consider your project sources to reside in src as the base you could try relative references like #include "../include/mqtt_interface.h" (aka one up from src into include).


Hello @ScruffR,

developing my project I don’t understan how to import an external libray.

I’m using the library ArduinoJson imported with “Particle: Import Library”.
If I include the library with #include “ArduinoJson.h” the compiler found the library but Visual Studio Code gave me an error because it did not find the “ArduinoJson.h”.

Same thing with the library “spark-dallas-temperature.h”.
The compiler find the library if I use #include “spark-dallas-temperature.h” but VS Code not.

Other external libraries like MQTT or OneWire work well with both compiler and VS Code.

I really don’t like to have false errrors for VS Code.

Thanks for the help.

Best Regards,

This is probably only an IntelliSense issue and hence something @m_m may want to chime in.

@fedex03 your best bet is to run through the debugging steps here:

1 Like