luc-github / ESP3DLib

ESP3D library for Marlin and ESP32 boards
GNU General Public License v3.0
98 stars 32 forks source link

[BUG] Cannot find U8glib.h when compiling in PlatformIO/VSCode #9

Closed vivian-ng closed 4 years ago

vivian-ng commented 4 years ago

I received errors:

.pio/libdeps/esp32/ESP3DLib/src/../../../../../Marlin/src/lcd/dogm/u8g_fontutf8.h:11:20: fatal error: U8glib.h: No such file or directory

It seems that using

#include MARLIN_PATH(lcd/ultralcd.h)

doesn't allow the eventual u8g_fontutf8.h to properly include #include <U8glib.h>.

I had to add

#include <U8glib.h>

to espcom.cpp in order to get it to compile.

Files further downstream being included using

#include "filename"

seems to work fine when using the MARLIN_PATH() macro, but files further downstream being included using

#include <filename>

seems to be causing issues.

luc-github commented 4 years ago

I will check tonight, path syntax may change if file is from Marlin or external library

luc-github commented 4 years ago

I reproduced it using CR10 display and MRR_ESPE, I have only tested with MRR_ESPA and oled and without LCD.

Working on it now

luc-github commented 4 years ago

@vivian-ng can you try to add

#if HAS_GRAPHICAL_LCD
    #include <U8glib.h>
#endif

in espcom.cpp like this

#include MARLIN_PATH(HAL/HAL_ESP32/HAL.h)
#if HAS_GRAPHICAL_LCD
    #include <U8glib.h>
#endif
#include MARLIN_PATH(lcd/ultralcd.h)

Compilation is ok on my side - but I do not have the hardware in hand to check is fine

also about :

Files further downstream being included using

include "filename"

seems to work fine when using the MARLIN_PATH() macro, but files further downstream being included using

#include <filename> seems to be causing issues.

can you share what file got the problem ?

vivian-ng commented 4 years ago

@luc-github The file with problem is U8glib.h.

I will give it a try when I can, but I don't expect any problems since I basically did the same thing.

luc-github commented 4 years ago

ho because I understood reading you that #include <U8glib.h> solve issue and after #include <filename> and so #include <U8glib> causing issue so I was confusing as it works on my side so I guessed it was another file

Ok so I can push this to devt branch then

felixstorm commented 4 years ago

Had the same issue - apparently PlatformIO does not detect that ESP3DLib needs U8glib. If we add #include <U8glib.h> somewhere, PlatformIO will add this lib's path also to the include path for ESP3DLib and then the includes further down will work ok.

luc-github commented 4 years ago

fix pushed to devt https://github.com/luc-github/ESP3DLib/tree/devt

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This stale issue has been automatically closed. Thank you for your contributions.

vivian-ng commented 4 years ago

@luc-github The fix here is in the devt branch, but not in the master branch. Will you be pushing it to the master branch soon? Otherwise, we may need to update the Marlin platformio.ini to use the devt branch by default, because I keep getting include failures as VSCode cannot find the required files.

luc-github commented 4 years ago

Done - sorry for the delay - I was busy with other projects and forget to push it when I fixed the Marlin 2.0.5 compilation issue