Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) ESP32 project has wrong WiFi.h (Read 5757 times)
Acuario
Senior Member
****
Offline


Posts: 256
Location: Spain
Joined: Aug 28th, 2015
ESP32 project has wrong WiFi.h
Oct 4th, 2018 at 3:44pm
Print Post  
Hi,
I'm trying out the ESP32 release 1.0.0 that I installed with Board manager. It seems the WiFi.h file is being included from the Arduino includes and not from the ESP32 includes. This throws up all sorts of problems. 

It seems the correct libraries are being built but the wrong header included. When I open the header from the .ino file it shows the Arduino one.

How can I fix this?


Building libraries ...

Using library WiFi version 1.2.6 in folder "file:///C:/Users/nigel/Documents/Arduino/libraries/WiFi"
c\1.22.0-80-g6c4433a-5.2.0/bin/xtensa-esp32-elf-g++" -DESP_PLATFORM -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DHAVE_CONFIG_H ols/sdk/include/config" ols/sdk/include/bluedroid" ols/sdk/include/bluedroid/api" ols/sdk/include/app_trace" ols/sdk/include/app_update" ols/sdk/include/bootloader_support" ols/sdk/include/bt" ols/sdk/include/driver" ols/sdk/include/esp32" ols/sdk/include/esp_adc_cal" ols/sdk/include/esp_http_client" ols/sdk/include/esp-tls" ols/sdk/include/ethernet" ols/sdk/include/fatfs" ols/sdk/include/freertos" ols/sdk/include/heap" ols/sdk/include/jsmn" ols/sdk/include/log" ols/sdk/include/mdns" ols/sdk/include/mbedtls" ols/sdk/include/mbedtls_port" ols/sdk/include/newlib" ols/sdk/include/nvs_flash" ols/sdk/include/openssl" ols/sdk/include/spi_flash" ols/sdk/include/sdmmc" ols/sdk/include/smartconfig_ack" ols/sdk/include/spiffs" ols/sdk/include/tcpip_adapter" ols/sdk/include/ulp" ols/sdk/include/vfs" ols/sdk/include/wear_levelling" ols/sdk/include/xtensa-debug-module" ols/sdk/include/coap" ols/sdk/include/console" ols/sdk/include/expat" ols/sdk/include/json" ols/sdk/include/lwip" ols/sdk/include/newlib" ols/sdk/include/nghttp" ols/sdk/include/soc" ols/sdk/include/wpa_supplicant" -std=gnu++11 -fno-exceptions -Os -g3 -Wpointer-arith -fexceptions -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -w -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -fno-rtti -MMD -c -DF_CPU=240000000L -DARDUINO=10805 -DARDUINO_NodeMCU_32S -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD=\"NodeMCU_32S\" -DARDUINO_VARIANT=\"nodemcu-32s\" -DESP32 -DCORE_DEBUG_LEVEL=0 res\esp32" riants\nodemcu-32s" -I"C:\Users\nigel\Documents\Arduino\libraries\WiFi\src" braries\ArduinoOTA\src" braries\Update\src" braries\SPI\src" braries\ESPmDNS\src" -I"C:\Program Files (x86)\Arduino\libraries" braries" -I"C:\Users\nigel\Documents\Arduino\libraries" -I"c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\ide\extensions\popb1ifx.eug\Micro Platforms\default\debuggers" "C:\Users\nigel\Documents\Arduino\libraries\WiFi\src\WiFi.cpp" -o WiFi\WiFi.cpp.o"

etc....

Opening WiFi.h it comes from:
C:\Users\nigel\Documents\Arduino\libraries\WiFi\src

It should come from:
ries\WiFi\src

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 project has wrong WiFi.h
Reply #1 - Oct 4th, 2018 at 9:35pm
Print Post  
There is a new version in the gallery 1810.4.0 which gives platform libs priority over IDE libs.

This should resolve the issue for you but we have conflicting forum reports from Teensy users who want to use ide libs instead of platform libs. Uggh, so this still needs investigation and might be an issue for other boards. More to follow during the next week or so.
  
Back to top
IP Logged
 
Acuario
Senior Member
****
Offline


Posts: 256
Location: Spain
Joined: Aug 28th, 2015
Re: ESP32 project has wrong WiFi.h
Reply #2 - Oct 5th, 2018 at 5:04am
Print Post  
Hi, unfortunately still the same.
I've emailed you the project.

The problem is when I add the OTA code 
#include <ArduinoOTA.h>
the project won't compile - I get the error:

ESPmDNS.cpp: In member function bool MDNSResponder::begin(const char*)
Error compiling libraries
Build failed for project 'ESP32Test'
 
ESPmDNS.cpp: 60:10: error: 'class WiFiClass' has no member named 'onEvent
   WiFi.onEvent(_on_sys_event)

The same error occurs in both cases of the WiFi.h inclusion.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 project has wrong WiFi.h
Reply #3 - Oct 5th, 2018 at 11:26am
Print Post  
Thanks, I just built your project with 1810.4 and it did find the wifi in the platform folder instead of the ide\libraries folder.

Please note that VS2017 has a stupid extension installer. Only after you close the ide and wait a few secs does the installer kick in. After install you can confirm the version number via "tools>extensions and updates>arduino ide for vs"

What version number shows for you? and please post another output.
« Last Edit: Oct 5th, 2018 at 11:27am by Tim@Visual Micro »  
Back to top
IP Logged
 
Acuario
Senior Member
****
Offline


Posts: 256
Location: Spain
Joined: Aug 28th, 2015
Re: ESP32 project has wrong WiFi.h
Reply #4 - Oct 5th, 2018 at 3:42pm
Print Post  
Hi, 
version is 18.10.4.0
I've included the full build output in the zip file.
..which doesn't seem to upload so I've emailed it as well.
« Last Edit: Oct 5th, 2018 at 3:45pm by Acuario »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 project has wrong WiFi.h
Reply #5 - Oct 5th, 2018 at 3:59pm
Print Post  
It won't upload because the build fails due to wrong wifi

I can see in the output that spi and all other libs have resolved to C:/Users/[your name]/AppData/Local/arduino15/packages/esp32/hardware/esp32/1.0.0/libraries

The only thing that I can think of that would make WiFi different would be if there is a shared library project reference in your solution pointing to the wrong lib. Shared lib references allow you to use a chosen library from any location hence it's the only thing that could affect this.

As a short term workaround and maybe a good test you could delete or move the C:/Users/nigel/Documents/Arduino/libraries/WiFi. Then click Rescan or restart the ide.
  
Back to top
IP Logged
 
Acuario
Senior Member
****
Offline


Posts: 256
Location: Spain
Joined: Aug 28th, 2015
Re: ESP32 project has wrong WiFi.h
Reply #6 - Oct 5th, 2018 at 4:35pm
Print Post  
Hi,
yes that fixed it. Interestingly after restoring the WiFi library and rescanning it still picks up the correct esp32 wifi library.

There weren't any shared lib references in the solution, basically only this project so I don't know where it could have picked up the wrong reference from. 

Anyway seems to be ok now - thanks for the help.
  
Back to top
 
IP Logged
 
Acuario
Senior Member
****
Offline


Posts: 256
Location: Spain
Joined: Aug 28th, 2015
Re: ESP32 project has wrong WiFi.h
Reply #7 - Oct 7th, 2018 at 5:53am
Print Post  
Ok, I have an update. The problem reoccurred so I investigated a bit further. Here are the steps I use to reproduce the problem.

My solution has 1 project (the one I sent you), nothing else. It is configured to target NodeMCU-32S.

If I have the standard Arduino WiFi libraries in my libraries folder then when a toolchain reload is done (I do this from the toolbar Add Library, Refresh) the wrong WiFi.h is picked up  (not the ESP32 one). 

Moving the WiFi folder out of my libraries folder and running refresh again, the correct ESP32 WiFi.h is included. 

If I then put the WiFi folder back into the libraries folder everything is ok UNTIL I do a refresh (or close/open VS) and then the incorrect WiFi.h is once again picked up.

This only seems to happen with WiFi.h

I just tried and renaming the WiFi folder to WiFi_16 also works and the correct WiFi.h is included.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 project has wrong WiFi.h
Reply #8 - Oct 7th, 2018 at 11:06am
Print Post  
Thanks I will look into it.

tip: Setup a shared library project reference and you will avoid any issues. There is a checkbox on the add library menu that creates a shared project which also includes a readme of how to add the shared reference. Make sure the right lib project is being used prior to adding the shared project otherwise you will have to remove it and add it again.
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 project has wrong WiFi.h
Reply #9 - Oct 7th, 2018 at 12:00pm
Print Post  
I tried this and I am not getting the issue. I wonder if a board package is causing the loader to fail at startup but is ignored when manually clicking rescan.

Please try to rename C:/Users/nigel/AppData/Local/arduino15 to some else such as C:/Users/nigel/AppData/Local/arduino15_Last

Then restart the ide and re-download the esp32 toolchain via board manager.

Does the problem go away?

  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint