Correct usage about including libraries.
Closed this issue · 4 comments
I do something like this:
Open my cygwin terminal ( I use win64 ) and input:
cd ~
git clone https://github.com/plerup/makeEspArduino.git
git clone https://github.com/eeyrw/LcdTcp # It's my arduino project.
alias espmake="make -f ~/makeEspArduino/makeEspArduino.mk"
cd LcdTcp
espmake
Then...
which: no esptool.py in (/usr/local/bin:/usr/bin:/cygdrive/f/Perl64/site/bin:/cygdrive/f/Perl64/bin:/cygdrive/f/Windows/system32:/cygdrive/f/Windows:/cygdrive/f/Windows/System32/Wbem:/cygdrive/f/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/f/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/f/Program Files (x86)/GTK2-Runtime/bin:/cygdrive/f/WINDOWS/system32:/cygdrive/f/WINDOWS:/cygdrive/f/WINDOWS/System32/Wbem:/cygdrive/f/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/e/Git/cmd:/cygdrive/f/mingw64/bin:/cygdrive/f/Program Files/TortoiseGit/bin:/cygdrive/e/GNU Tools ARM Embedded/7 2017-q4-major/bin:/cygdrive/f/Users/yuan/AppData/Local/Microsoft/WindowsApps:/cygdrive/e/SDCC/bin:/cygdrive/e/CMake/bin:/cygdrive/d/Microsoft VS Code/bin:/usr/bin:/cygdrive/d/stm8flash:/cygdrive/e/avra-1.3.0/src)
which: no esptool.py in (/usr/local/bin:/usr/bin:/cygdrive/f/Perl64/site/bin:/cygdrive/f/Perl64/bin:/cygdrive/f/Windows/system32:/cygdrive/f/Windows:/cygdrive/f/Windows/System32/Wbem:/cygdrive/f/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/f/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/f/Program Files (x86)/GTK2-Runtime/bin:/cygdrive/f/WINDOWS/system32:/cygdrive/f/WINDOWS:/cygdrive/f/WINDOWS/System32/Wbem:/cygdrive/f/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/e/Git/cmd:/cygdrive/f/mingw64/bin:/cygdrive/f/Program Files/TortoiseGit/bin:/cygdrive/e/GNU Tools ARM Embedded/7 2017-q4-major/bin:/cygdrive/f/Users/yuan/AppData/Local/Microsoft/WindowsApps:/cygdrive/e/SDCC/bin:/cygdrive/e/CMake/bin:/cygdrive/d/Microsoft VS Code/bin:/usr/bin:/cygdrive/d/stm8flash:/cygdrive/e/avra-1.3.0/src)
abi.cpp
base64.cpp
cbuf.cpp
cont.S
cont_util.c
core_esp8266_eboot_command.c
core_esp8266_flash_utils.c
core_esp8266_i2s.c
core_esp8266_main.cpp
core_esp8266_noniso.c
core_esp8266_phy.c
core_esp8266_postmortem.c
core_esp8266_si2c.c
core_esp8266_timer.c
core_esp8266_wiring.c
core_esp8266_wiring_analog.c
core_esp8266_wiring_digital.c
core_esp8266_wiring_pulse.c
core_esp8266_wiring_pwm.c
core_esp8266_wiring_shift.c
debug.cpp
Esp.cpp
FS.cpp
FunctionalInterrupt.cpp
HardwareSerial.cpp
heap.c
IPAddress.cpp
cdecode.c
cencode.c
libc_replacements.c
MD5Builder.cpp
pgmspace.cpp
Print.cpp
Schedule.cpp
sntp-lwip2.c
spiffs_cache.c
spiffs_check.c
spiffs_gc.c
spiffs_hydrogen.c
spiffs_nucleus.c
spiffs_api.cpp
spiffs_hal.cpp
Stream.cpp
StreamString.cpp
time.c
Tone.cpp
uart.c
umm_malloc.c
Updater.cpp
WMath.cpp
WString.cpp
Creating core archive
LcdTcp.ino
In file included from LcdTcp.ino:2:0:
LcdTcp.h:11:25: fatal error: ESP8266WiFi.h: No such file or directory
#include <ESP8266WiFi.h>
^
compilation terminated.
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:220:F:/cygwin64/tmp/mkESP/LcdTcp_generic/LcdTcp_.cpp.o] error 1
It seems that library ESP8266WiFi should be included manually ?
How can I make it work ?
---------------Half an hour later------------------
I create a config.mk like this:
THIS_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
ROOT := $(THIS_DIR)/..
LIBS = $(ESP_LIBS)/SPI \
$(ESP_LIBS)/Wire \
$(ESP_LIBS)/ESP8266WiFi \
UPLOAD_SPEED = 115200
And copy my libraries dir to my project root. But it get even worse...
$ espmake
which: no esptool.py in (/usr/local/bin:/usr/bin:/cygdrive/f/Perl64/site/bin:/cygdrive/f/Perl64/bin:/cygdrive/f/Windows/system32:/cygdrive/f/Windows:/cygdrive/f/Windows/System32/Wbem:/cygdrive/f/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/f/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/f/Program Files (x86)/GTK2-Runtime/bin:/cygdrive/f/WINDOWS/system32:/cygdrive/f/WINDOWS:/cygdrive/f/WINDOWS/System32/Wbem:/cygdrive/f/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/e/Git/cmd:/cygdrive/f/mingw64/bin:/cygdrive/f/Program Files/TortoiseGit/bin:/cygdrive/e/GNU Tools ARM Embedded/7 2017-q4-major/bin:/cygdrive/f/Users/yuan/AppData/Local/Microsoft/WindowsApps:/cygdrive/e/SDCC/bin:/cygdrive/e/CMake/bin:/cygdrive/d/Microsoft VS Code/bin:/usr/bin:/cygdrive/d/stm8flash:/cygdrive/e/avra-1.3.0/src)
which: no esptool.py in (/usr/local/bin:/usr/bin:/cygdrive/f/Perl64/site/bin:/cygdrive/f/Perl64/bin:/cygdrive/f/Windows/system32:/cygdrive/f/Windows:/cygdrive/f/Windows/System32/Wbem:/cygdrive/f/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/f/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/f/Program Files (x86)/GTK2-Runtime/bin:/cygdrive/f/WINDOWS/system32:/cygdrive/f/WINDOWS:/cygdrive/f/WINDOWS/System32/Wbem:/cygdrive/f/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/e/Git/cmd:/cygdrive/f/mingw64/bin:/cygdrive/f/Program Files/TortoiseGit/bin:/cygdrive/e/GNU Tools ARM Embedded/7 2017-q4-major/bin:/cygdrive/f/Users/yuan/AppData/Local/Microsoft/WindowsApps:/cygdrive/e/SDCC/bin:/cygdrive/e/CMake/bin:/cygdrive/d/Microsoft VS Code/bin:/usr/bin:/cygdrive/d/stm8flash:/cygdrive/e/avra-1.3.0/src)
abi.cpp
base64.cpp
cbuf.cpp
cont.S
cont_util.c
core_esp8266_eboot_command.c
core_esp8266_flash_utils.c
core_esp8266_i2s.c
core_esp8266_main.cpp
core_esp8266_noniso.c
core_esp8266_phy.c
core_esp8266_postmortem.c
core_esp8266_si2c.c
core_esp8266_timer.c
core_esp8266_wiring.c
core_esp8266_wiring_analog.c
core_esp8266_wiring_digital.c
core_esp8266_wiring_pulse.c
core_esp8266_wiring_pwm.c
core_esp8266_wiring_shift.c
debug.cpp
Esp.cpp
FS.cpp
FunctionalInterrupt.cpp
HardwareSerial.cpp
heap.c
IPAddress.cpp
cdecode.c
cencode.c
libc_replacements.c
MD5Builder.cpp
pgmspace.cpp
Print.cpp
Schedule.cpp
sntp-lwip2.c
spiffs_cache.c
spiffs_check.c
spiffs_gc.c
spiffs_hydrogen.c
spiffs_nucleus.c
spiffs_api.cpp
spiffs_hal.cpp
Stream.cpp
StreamString.cpp
time.c
Tone.cpp
uart.c
umm_malloc.c
Updater.cpp
WMath.cpp
WString.cpp
Creating core archive
LcdTcp.ino
CmdProc.cpp
LcdInterface.cpp
LCD_I2C.cpp
WiFiManager.cpp
LiquidCrystal_I2C.cpp
TcpServer.cpp
WifiConnection.cpp
SPI.cpp
Wire.cpp
ESP8266WiFi.cpp
ESP8266WiFiAP.cpp
ESP8266WiFiGeneric.cpp
ESP8266WiFiMulti.cpp
ESP8266WiFiScan.cpp
ESP8266WiFiSTA.cpp
WiFiClient.cpp
WiFiClientSecure.cpp
WiFiServer.cpp
WiFiUdp.cpp
Linking F:/cygwin64/tmp/mkESP/LcdTcp_generic/LcdTcp.bin
Versions: Unknown, 2.4.0
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:(.text._ZN11WiFiManager10handleInfoEv+0x74): undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:(.text._ZN11WiFiManager10handleInfoEv+0x78): undefined reference to `ESP8266WebServer::send(int, char const*, String const&)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::handleInfo()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `String::operator+=(__FlashStringHelper const*)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::send(int, char const*, String const&)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `String::operator+=(String const&)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::send(int, char const*, String const&)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `DEBUG_WM<String>':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::~ESP8266WebServer()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `std::default_delete<ESP8266WebServer>::operator()(ESP8266WebServer*) const':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::~ESP8266WebServer()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:(.text._ZN11WiFiManager14handleWifiSaveEv+0x38): undefined reference to `ESP8266WebServer::arg(String)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:(.text._ZN11WiFiManager14handleWifiSaveEv+0x68): undefined reference to `ESP8266WebServer::arg(String)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:(.text._ZN11WiFiManager14handleWifiSaveEv+0x90): undefined reference to `ESP8266WebServer::arg(String)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:(.text._ZN11WiFiManager14handleWifiSaveEv+0xc7): undefined reference to `ESP8266WebServer::arg(String)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:(.text._ZN11WiFiManager14handleWifiSaveEv+0x144): undefined reference to `ESP8266WebServer::arg(String)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:(.text._ZN11WiFiManager14handleWifiSaveEv+0x17b): more undefined references to `ESP8266WebServer::arg(String)' follow
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::handleWifiSave()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::send(int, char const*, String const&)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `String::operator+=(__FlashStringHelper const*)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::handleWifi(unsigned char)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::send(int, char const*, String const&)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `DNSServer::DNSServer()'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::ESP8266WebServer(int)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `DNSServer::setErrorReplyCode(DNSReplyCode const&)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `DNSServer::start(unsigned short const&, String const&, IPAddress const&)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::on(String const&, std::function<void ()>)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::onNotFound(std::function<void ()>)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::begin()'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `DNSServer::DNSServer()'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::ESP8266WebServer(int)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `String::operator+=(String const&)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `DNSServer::setErrorReplyCode(DNSReplyCode const&)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `std::unique_ptr<DNSServer, std::default_delete<DNSServer> >::reset(DNSServer*)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `DNSServer::start(unsigned short const&, String const&, IPAddress const&)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::setupConfigPortal()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::on(String const&, std::function<void ()>)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::on(String const&, std::function<void ()>)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `IPAddress':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::on(String const&, std::function<void ()>)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::setupConfigPortal()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::on(String const&, std::function<void ()>)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::on(String const&, std::function<void ()>)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: more undefined references to `ESP8266WebServer::on(String const&, std::function<void ()>)' follow
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `_Head_base<bool, void>':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::onNotFound(std::function<void ()>)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `bind<void (WiFiManager::*)(unsigned char), WiFiManager* const, bool>':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::begin()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::setupConfigPortal()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `DNSServer::processNextRequest()'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::handleClient()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `_Bind<WiFiManager* const>':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `DNSServer::processNextRequest()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `String::operator+=(__FlashStringHelper const*)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::handleClient()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::autoConnect(char const*, char const*)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::hostHeader()'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::hostHeader()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::captivePortal()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `StringSumHelper':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::send(int, char const*, String const&)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::handleRoot()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::send(int, char const*, String const&)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `String::operator+=(char const*)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::args()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `String::operator+=(__FlashStringHelper const*)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::argName(int)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::arg(int)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::handleRoot()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::args()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o:(.text._ZN11WiFiManager14handleNotFoundEv+0xe0): undefined reference to `ESP8266WebServer::argName(int)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::handleNotFound()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::arg(int)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `String::operator+=(char const*)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::args()'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::handleNotFound()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `String::operator+=(char const*)':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/tmp/mkESP/LcdTcp_generic/WiFiManager.cpp.o: In function `WiFiManager::handleNotFound()':
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::sendHeader(String const&, String const&, bool)'
F:/cygwin64/home/yuan/LcdTcp/libraries/WiFiManager/WiFiManager.cpp:759: undefined reference to `ESP8266WebServer::send(int, char const*, String const&)'
collect2.exe: error: ld returned 1 exit status
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:244:F:/cygwin64/tmp/mkESP/LcdTcp_generic/LcdTcp.bin] 错误 1
It appears that the lib WiFiManager requires other libs... So should I add it in my config.mk one by one ..?
It sounds really tough..
In the first case the needed dependencies are automatically detected from the includes in the sketch. This does not work recursively though and your includes are in the Lcdtcp.h, hence the missing ESP8266WiFi etc
In the second case there should be no need for copying of the libraries but you have to add the WifFiManager and the ESP8266WebServer directories to LIBS as well
Thank for your rapid reply :) Finally I modify my config.mk to :
THIS_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
ROOT := $(THIS_DIR)/..
LIBS = $(ESP_LIBS)/SPI \
$(ESP_LIBS)/Wire \
$(ESP_LIBS)/ESP8266WiFi \
$(ESP_LIBS)/ESP8266WebServer \
$(ESP_LIBS)/DNSServer
BOARD = nodemcuv2
UPLOAD_PORT = COM7
UPLOAD_SPEED = 1500000
FLASH_DEF=4M3M
VERBOSE=1
I notice that a solution for auto including has been put forward in pull request #63 . Maybe it helps ?
As you said, I remove the libraries dir from my project root. But things seem not quite simple..
In file included from LcdTcp.ino:2:0:
LcdTcp.h:14:73: fatal error: WiFiManager.h: No such file or directory
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
^
compilation terminated.
In file included from CmdProc.cpp:1:0:
LcdTcp.h:14:73: fatal error: WiFiManager.h: No such file or directory
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
^
compilation terminated.
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:220:F:/cygwin64/tmp/mkESP/LcdTcp_nodemcuv2/LcdTcp_.cpp.o] 错误 (error) 1
make: *** 正在等待未完成的任务 ( waiting for unfinished task )....
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:216:F:/cygwin64/tmp/mkESP/LcdTcp_nodemcuv2/CmdProc.cpp.o] 错误 1
In file included from LcdInterface.cpp:8:0:
LcdTcp.h:14:73: fatal error: WiFiManager.h: No such file or directory
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
^
compilation terminated.
In file included from LCD_I2C.cpp:3:0:
LcdTcp.h:14:73: fatal error: WiFiManager.h: No such file or directory
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
^
compilation terminated.
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:215:F:/cygwin64/tmp/mkESP/LcdTcp_nodemcuv2/LcdInterface.cpp.o] 错误 1
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:215:F:/cygwin64/tmp/mkESP/LcdTcp_nodemcuv2/LCD_I2C.cpp.o] 错误 1
WiFiManager is lib downloaded by Arduino library manager and it locates at F:\Users\yuan\Documents\Arduino\libraries
. This path is different from F:\Users\yuan\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries
. It seems makeEspArduino do not detect the libraries in user's document directory.
I check the makeEspArduino.mk ( I am a totally newbie of gnu make.. ) and I found a piece of code actually detect that directory.
....
# ESP Arduino directories
OS ?= $(shell uname -s)
ifndef ESP_ROOT
# Location not defined, find and use possible version in the Arduino IDE installation
ifeq ($(OS), Windows_NT)
ARDUINO_ROOT = $(shell cygpath -m $(LOCALAPPDATA)/Arduino15)
else ifeq ($(OS), Darwin)
ARDUINO_ROOT = $(HOME)/Library/Arduino15
else
ARDUINO_ROOT = $(HOME)/.arduino15
endif
ARDUINO_ESP_ROOT = $(ARDUINO_ROOT)/packages/$(CHIP)
ESP_ROOT := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/hardware/$(CHIP)/*))
ifeq ($(ESP_ROOT),)
$(error No installed version of $(CHIP) Arduino found)
endif
# I think this sentence is for finding out the correct path of Arduino libraries downloaded by library manager.
ARDUINO_LIBS = $(shell grep -o "sketchbook.path=.*" $(ARDUINO_ROOT)/preferences.txt 2>/dev/null | cut -f2- -d=)/libraries
ESP_ARDUINO_VERSION := $(notdir $(ESP_ROOT))
# Find used version of compiler and tools
COMP_PATH := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/tools/xtensa-lx106-elf-gcc/*))
ESPTOOL_PATH := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/tools/esptool/*))
MKSPIFFS_PATH := $(lastword $(wildcard $(ARDUINO_ESP_ROOT)/tools/mkspiffs/*))
else
# Location defined, assume it is a git clone
ESP_ARDUINO_VERSION = $(call git_description,$(ESP_ROOT))
endif
.....
So I still have no idea why it doesn't works : (
----------------10 minutes later-------------------
I found another code snippet relevant to ARDUINO_LIBS
:
# User defined compilation units and directories
ifeq ($(LIBS),)
# Automatically find directories with header files used by the sketch
LIBS := $(shell perl -e 'use File::Find;@d = split(" ", shift);while (<>) {$$f{"$$1"} = 1 if /^\s*\#include\s+[<"]([^>"]+)/;}find(sub {if ($$f{$$_}){print $$File::Find::dir," ";$$f{$$_}=0;}}, @d);' \
"$(CUSTOM_LIBS) $(ESP_LIBS) $(ARDUINO_LIBS)" $(SKETCH))
endif
It obviously checks the "#include " in "main.ino" and add to $LIBS. But it only happens when $LIBS are not defined by user. So I still try to modify my config.mk:
THIS_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
ROOT := $(THIS_DIR)/..
LIBS = $(ESP_LIBS)/SPI \
$(ESP_LIBS)/Wire \
$(ESP_LIBS)/ESP8266WiFi \
$(ESP_LIBS)/ESP8266WebServer \
$(ESP_LIBS)/DNSServer \
$(ESP_LIBS)/DNSServer \
$(ARDUINO_LIBS)/WiFiManager \
$(ARDUINO_LIBS)/CircularBuffer
BOARD = nodemcuv2
UPLOAD_PORT = COM7
UPLOAD_SPEED = 1500000
FLASH_DEF=4M3M
VERBOSE=1
I think the added code piece $(ARDUINO_LIBS)/WiFiManager \ $(ARDUINO_LIBS)/CircularBuffer
should be quite reasonable and it should works perfectly. However...
$ make -f ~/makeEspArduino/makeEspArduino.mk -j8
find: ‘F:UsersyuanDocumentsArduino/libraries/’: No such file or directory
find: ‘F:UsersyuanDocumentsArduino/libraries/’: No such file or directory
find: ‘F:UsersyuanDocumentsArduino/libraries/WiFiManager’: No such file or directory
find: ‘F:UsersyuanDocumentsArduino/libraries/CircularBuffer’: No such file or directory
find: ‘F:UsersyuanDocumentsArduino/libraries/’: No such file or directory
find: ‘F:UsersyuanDocumentsArduino/libraries/’: No such file or directory
find: ‘F:UsersyuanDocumentsArduino/libraries/WiFiManager’: No such file or directory
find: ‘F:UsersyuanDocumentsArduino/libraries/CircularBuffer’: No such file or directory
abi.cpp
base64.cpp
cbuf.cpp
cont.S
cont_util.c
core_esp8266_eboot_command.c
core_esp8266_flash_utils.c
core_esp8266_i2s.c
core_esp8266_main.cpp
core_esp8266_noniso.c
core_esp8266_phy.c
core_esp8266_postmortem.c
core_esp8266_si2c.c
core_esp8266_timer.c
core_esp8266_wiring.c
core_esp8266_wiring_analog.c
core_esp8266_wiring_digital.c
core_esp8266_wiring_pulse.c
core_esp8266_wiring_pwm.c
core_esp8266_wiring_shift.c
debug.cpp
Esp.cpp
FS.cpp
FunctionalInterrupt.cpp
HardwareSerial.cpp
heap.c
IPAddress.cpp
cdecode.c
cencode.c
libc_replacements.c
MD5Builder.cpp
pgmspace.cpp
Print.cpp
Schedule.cpp
sntp-lwip2.c
spiffs_cache.c
spiffs_check.c
spiffs_gc.c
spiffs_hydrogen.c
spiffs_nucleus.c
spiffs_api.cpp
spiffs_hal.cpp
Stream.cpp
StreamString.cpp
time.c
Tone.cpp
uart.c
umm_malloc.c
Updater.cpp
WMath.cpp
WString.cpp
LcdTcp.ino
CmdProc.cpp
LcdInterface.cpp
LCD_I2C.cpp
LiquidCrystal_I2C.cpp
In file included from CmdProc.cpp:1:0:
LcdTcp.h:14:73: fatal error: WiFiManager.h: No such file or directory
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
^
compilation terminated.
In file included from LcdTcp.ino:2:0:
LcdTcp.h:14:73: fatal error: WiFiManager.h: No such file or directory
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
^
compilation terminated.
In file included from LcdInterface.cpp:8:0:
LcdTcp.h:14:73: fatal error: WiFiManager.h: No such file or directory
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
^
compilation terminated.
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:217:F:/cygwin64/tmp/mkESP/LcdTcp_nodemcuv2/CmdProc.cpp.o] 错误 1
make: *** 正在等待未完成的任务....
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:217:F:/cygwin64/tmp/mkESP/LcdTcp_nodemcuv2/LcdInterface.cpp.o] 错误 1
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:221:F:/cygwin64/tmp/mkESP/LcdTcp_nodemcuv2/LcdTcp_.cpp.o] 错误 1
In file included from LCD_I2C.cpp:3:0:
LcdTcp.h:14:73: fatal error: WiFiManager.h: No such file or directory
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
^
compilation terminated.
make: *** [/home/yuan/makeEspArduino/makeEspArduino.mk:216:F:/cygwin64/tmp/mkESP/LcdTcp_nodemcuv2/LCD_I2C.cpp.o] 错误 1
The directory F:\Users\yuan\Documents\Arduino\libraries
became something horrible in Windows..By the way, parallel build seems working. I am not familiar with gnu make and Linux matters. So how can I fix the horrible path ?
--------15 minutes later---------
I find cygpath is what exactly dedicated for such kind of problem and I make slight change and finally it works...........
Check my fork https://github.com/eeyrw/makeEspArduino
If you feel my change is reasonable enough, I may issue a pull request.
Please try the latest commit
I have tried the last commit, however the recursive autoinclude still remains a problem. I'm trying to compile the example Advanced.ino contained in the famous WiFiManager by tzapu (just to test this makefile). However I can't compiled it if I don't manually specify the ESP8266WiFi directory... My makefile is really simple:
SKETCH = $(HOME)/workspace_arduino/Advanced/Advanced.ino
CHIP = esp8266
BOARD = d1_mini
include $(HOME)/makeEspArduino/makeEspArduino.mk
This gives the following:
In file included from C:/Users/fabiu/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/WiFiManager-development/src/WiFiManager.cpp:13:0:
C:/Users/fabiu/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/WiFiManager-development/src/WiFiManager.h:32:29: fatal error: ESP8266WiFi.h: No such file or directory
#include <ESP8266WiFi.h>
^
compilation terminated.