Newbie - getting to WiFi Blinky NodeMCU

OK, first time poster, short time PlatformIO user (under a week since first setup in Atom). Trying to unravel 101 stuff…

As you may know, there’s a lot of libraries that cover Arduino ESP8266, and also use the same or similarly named includes (yes, I’m pointing at you Arduino and “WiFi” and “WiFi Link”), so there’s an element of “what’s best” to my question as well.

I have some code (from a random internet source) that I wanted to test. I add what I think are the logical libs to the global cache. I create a new project, add my code, run build, and get errors… all basically similar, pointing back to some missing definition that I don’t have. “error: ‘WiFiServer’ does not name a type” and then later, objects not being declared in this scope.

So in my exploration, I tried backtracking using the search capability for the named header files, and I seem to have every one mentioned in the code, but still get the errors. I honestly think there’ll be one magic moment where I add one base library and all these errors will disappear, but I just can’t see the tree for the forest :slight_smile:

How do other people backtrack through some example code and find what others have used? Searching for headers sufficient?

And does anyone have a really simple example on WiFi with NodeMCU and want to name the dependencies and their associated libraries?

Library Dependency Graph
|-- <WiFi> v1.2.7
|-- <ESP8266WebServer> v1.0
| |-- <ESP8266wifi>
| |-- <WiFi> v1.2.7
|-- <ESP8266mDNS>
| |-- <WiFi> v1.2.7
| |-- <ESP8266wifi>
|-- <ESP8266wifi>

Edit: for anyone wondering, this all comes from adding the project example for espressif\esp8266-webserver via the homepage added to Atom…

Ok, so here’s my latest findings. Again, total newbie, no idea what I am doing wrong… but I take a simple example, create a new project, select NodeMCUv2 board and a unique home directory, create main.ino file. Add the code that just opens serial port for debug output in SETUP(). In loop(), just delay and serial print something. Build and deploy, all works fine, serial port observes output as expected.

Add in an include, #include <ESP8266WiFi.h> (confirmed I have that library installed, in global storage, ID 1101 ). Try to build, and get errors that seem to be related to progmem issues;

Compiling .pioenvs\nodemcuv2\lib\ESP8266wifi_ID1101\ESP8266wifi.o
C:\Users\d.platformio\lib\ESP8266wifi_ID1101\ESP8266wifi.cpp:14:57: error: ‘const char OK []’ redeclared as different kind of symbol
#define PROGMEM attribute((section(".progmem.data")))
^
C:\Users\d.platformio\lib\ESP8266wifi_ID1101\ESP8266wifi.cpp:17:17: note: in expansion of macro 'PROGMEM’
const char OK[] PROGMEM = “OK”;
^

Any thoughts what I’ve missed or not got set up correctly?

IDE Version 2.0.0-beta.4
Core version 3.4.0b9
(installed earlier this week - earlier a pio upgrade didn’t find any updates, but now have Core 3.4.0b10 and still the same failure)

And I just downloaded the same example from GitHub platform-espressif8266/examples/arduino-webserver at develop · platformio/platform-espressif8266 · GitHub and tested as per the instructions there…

Create new project, open the saved example path, attempt Build; same errors. At this stage not sure what I can do to further diagnose or even to test out PlatformIO :frowning: Hoping someone can set me on the path to enlightenment…

Converting HelloServer.ino
Collected 28 compatible libraries
Looking for dependencies…

Library Dependency Graph
|-- <WiFi Link> v1.0.1
|-- <ESP8266WebServer> v1.0
| |-- <_ESP8266wif_i>
| |-- <WiFi Link> v1.0.1
|-- <ESP8266mDNS>
| |-- <WiFi Link> v1.0.1
| |-- <ESP8266wifi>
|-- <ESP8266wifi>
Compiling .pioenvs\esp01\src\HelloServer.ino.o
Archiving .pioenvs\esp01\libFrameworkArduinoVariant.a
Compiling .pioenvs\esp01\FrameworkArduino\Esp.o
Compiling .pioenvs\esp01\FrameworkArduino\FS.o
Compiling .pioenvs\esp01\FrameworkArduino\HardwareSerial.o
In file included from C:/Users/d/OneDrive/Development/PlatformIO/esp8266-webserver/src/HelloServer.ino:4:0:
C:\Users\d.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WebServer\src/ESP8266WebServer.h:153:3: error
: ‘WiFiServer’ does not name a type

WiFiServer _server;
^

So still don’t understand what is going on here, but perhaps this gets closer…

It seems like the build process isn’t actually evaluating the dependency tree correctly, when it comes to #INCLUDEs inside includes that the .INO file includes.

I also tested this in PIO for VS-Code, no difference.

Lets use this as an example.
In file included from C:/Users/d/OneDrive/Development/PlatformIO/esp8266-webserver/src/HelloServer.ino:4:0:
C:\Users\d.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WebServer\src/ESP8266WebServer.h:153:3: error
: ‘WiFiServer’ does not name a type
WiFiServer _server;
^

I added to my .INO file #include <WiFiServer.h> and build then removed that error. I then added a couple of other includes to remove more errors. Dependency tree now evaluates as:
Library Dependency Graph
|-- <ESP8266wifi>
|-- <ESP8266WiFi> v1.0
|-- <ESP8266WebServer> v1.0
| |-- <ESP8266wifi>
| |-- <WiFi Link> v1.0.1
|-- <ESP8266mDNS>
| |-- <ESP8266wifi>
| |-- <ESP8266WiFi> v1.0
| |-- <WiFi Link> v1.0.1
|-- <WiFi Link> v1.0.1

Should I have to keep adding dependent includes in my main code??

In comparison, I installed the Arduino IDE, added the ESP8266 hardware support, set my board to NodeMCU v1.0 (ESP12-E) and compiled - looks like it worked first time.

You have multiple versions of ESP8266wifi library. Please ignore one of them. See

Thanks for the reply - I’ve been snowed at work so personal stuff got pushed aside :slight_smile:

Can you elaborate on what I’ve done wrong here, and how I can undo it? I’m not really sure which one of the libraries I’ve included incorrectly and should exclude, and how I should use the lib_ignore, as ignoring ESP8266WiFi itself didn’t resolve the issue…

Could you open PIO IDE Terminal and type pio run --verbose, you will see the full path for each library.

1 Like

I’m guessing you must have found the issue. I opened Atom, took an update for the Platform IO components (2.0.0-beta6 and 3.4.1a5) and now opening and building my old projects works without problem.