VS Arduino
Visual Micro >> Other Hardware >> Intellisense for Libraries - ESP8266WiFi #include in .cpp
https://www.visualmicro.com/forums/YaBB.pl?num=1467142157

Message started by lukasz on Jun 28th, 2016 at 7:29pm

Title: Intellisense for Libraries - ESP8266WiFi #include in .cpp
Post by lukasz on Jun 28th, 2016 at 7:29pm
Hello, I have a problem with ESP8266WiFi library. If i include like here #include <ESP8266WiFi\src\WiFiClient.h> IDE shows my code fine and i can normally write, but when i want to compile there are undefined reference errors. When i change including style to #include <ESP8266WiFi.h> and i check-in Deep Search it compiles normally, but IDE underlines a lot of my code as error and i can't work normally. I would be grateful if you will repair this bug :)
PS I have visual studio 2015

Title: Re: Intellisense for Libraries - ESP8266WiFi #include in .cpp
Post by Visual Micro on Jun 28th, 2016 at 7:44pm
Hi,

Yes for Arduino you must include #include <ESP8266WiFi.h> which will automatically discover the correct location.

The deep search is a new feature in the Arduino Ide and also in Visual Micro. It is a slow system but avoided new users needing to know one useful historic Arduino fact...

Historically, all Arduino library #includes must be in the project_name.ino even if they are only used in .cpp files. I am assuming you have included the lib in your .cpp file but not in the .ino code.

Because "deep search" is so slow it is not a practical solution for intellisense purposes so a caching system is being developed. It's complicated, prone to problems and still requires some searching when libraries are added to projects or new projects are created so the current recommendation is to ensure the #include is in the <project_name.ino>.

Click save or build after adding the #include which forces an intellisense refresh alternatively use the Visual Micro "Add Library" facility which adds the #includes and performs the save.

The other benefit of adding the #includes to the .ino is that unless you have conditional #includes (surrounded by #if) you will not need Deep Search enabled and the build will be faster.

This link will be updated when things change



VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.