Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • 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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Compiler not able to find available files (Read 205 times)
johnnyg
Newbies
*
Offline



Posts: 6
Compiler not able to find available files
Aug 22nd, 2020 at 3:15pm
 
Hello,  I have run into a problem compiling where library files that do exist cannot be located.

At line 606 in the attached log: Adafruit_MCP4725.h: 10:37: fatal error: Adafruit_BusIO_Register.h: No such file or directory
If I search for Adafruit_BusIO_Register.h the file does exist in the library path R:\Code\Arduino\libraries\Adafruit_BusIO\Adafruit_BusIO_Register.h

This has been happening frequently after getting back into some coding for an ESP8266 project.  I've had to bounce between board versions to work around bugs and update the Arduino libraries that are used.


Thank you,
John
Back to top
 

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



Posts: 10821
United Kingdom
Re: Compiler not able to find available files
Reply #1 - Aug 22nd, 2020 at 3:53pm
 
Hi

Thanks for the info.

If you have been switching some library sources I suggest click "Build>Clean Solution". This will ensure all files are recompiled.

If that does not resolve then please confirm if you have the libraries in your solution as "shared projects" or not. If you do have shared library projects in your solution they could now be pointing to invalid lib sources. Either correct the problem or remove re-add them again. Re-adding them will allow Visual Micro to set them up again for you.

Finally make sure the libraries you are using are matched correctly and they follow the arduino library path resolution rules.  A library in the sketchbook/libraries folder will take priority unless it contains a library.properties setting that excludes it for the current toolchain. The Adafruit_BusIO library does not appear to be matched to the library that contains the Adafruit_MCP4725.h



Back to top
 
WWW  
IP Logged
 
johnnyg
Newbies
*
Offline



Posts: 6
Re: Compiler not able to find available files
Reply #2 - Aug 25th, 2020 at 3:34am
 
Hi Tim,

Thank you for the suggestion to run the Clean Solution tool.  I ran it, re-scanned libraries and rebuilt with similar issues; "No such file or directory" along with "was not declared in this scope", "does not name a type"

The Solution Explorer shows the header files under the Project -> External Dependencies.

I can navigate to the files using the ctrl + click to jump to the declarations, but the build output says the files cannot be found.

I rolled back some of the library updates and also moved some of the libraries used into the Sketch folders, changed the respective #includes from <> to "", no change.

I changed some of the #include paths to be absolute and some of the intellisense errors and "No such file or directory" build erros go away, but there are still errors for "does not name a type" and "was not declared in this scope", but I can navigate to the type declarations as well.

Regards
Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
johnnyg
Newbies
*
Offline



Posts: 6
Re: Compiler not able to find available files
Reply #3 - Aug 28th, 2020 at 2:21pm
 
I'm seeing massive inconsistencies.

- Using ESP8266 v2.7.4
- I moved the desired SD library into the sketch folder, yet using "" in the include did not force the compiler to use those files, it won't build for the 'File' being ambiguous from the desired library and the ESP8266 core SD files.
- I had to prefix the use of 'File' in my code with 'SDLib::' to resolve the ambiguity. Once this was working I found numerous issues with code in the ESP8266 hardware core that I was not going to mess with.
- I changed the board back to ESP8266 v2.4.0 (that was working two weeks ago) and now other core files had a problem with the SD library files
- I tried switching back to ESP8266 v2.7.4, (always 'cleaning solution' and re-scanning the toolchain), now the compiler cannot find stdlib.h, stdint.h, stdio.h.  The files exist in the "Arduino\hardware\tools\avr\avr\include\" path, yet the compiler won't find them. I tried chasing some of them with absolute paths in the Arduino.h file but that isolate missing includes further down.

Not sure what to do or what is going on, changing back and forth on board version and getting different results, all on code that was working for a year while trying to work around minor board bugs like a memory leak.  Now every application I have that uses this device won't build even with modifying code that was working.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10821
United Kingdom
Re: Compiler not able to find available files
Reply #4 - Aug 28th, 2020 at 6:50pm
 
Hi

I would ignore intellisense errors until you have a succesful build. Only after a successful build can intellisense paths be updated from the actual results. Intellisense is more lienent because code is treated as work in progress by VS, without a build it has to make some guesses. It's also a good idea to switch off debugging until you have a working project because that adds a lot more to the diagnostics output.

It appears the problem is that your ESP8266_WebServer_Stove.ino code attempts to use Sd2Card, SdVolume, SdFile and I guess they don't exist in the esp8266/2.7.4/libraries/SD library? Does this compile using the Arduino IDE?

Code (C++):
"C:\Users\John\AppData\Local\Temp\VMBuilds\ESP8266_WebServer_Stove\esp8266_nodemcuv2\Debug\ESP8266_WebServer_Stove.cpp" -o "C:\Users\John\AppData\Local\Temp\VMBuilds\ESP8266_WebServer_Stove\esp8266_nodemcuv2\Debug\ESP8266_WebServer_Stove.cpp.o"

ESP8266_WebServer_Stove.ino: 237:1: error: 'Sd2Card' does not name a type
   SdFile _root

ESP8266_WebServer_Stove.ino: 238:1: error: 'SdVolume' does not name a type
   SdFile _logfile; \\ SdFile?

ESP8266_WebServer_Stove.ino: 239:1: error: 'SdFile' does not name a type

ESP8266_WebServer_Stove.ino: 240:1: error: 'SdFile' does not name a type
   From server

ESP8266_WebServer_Stove.ino: In function bool configSdCard(int)

ESP8266_WebServer_Stove.ino: 1560:6: error: '_card' was not declared in this scope
   ")

ESP8266_WebServer_Stove.ino: 1573:9: error: '_card' was not declared in this scope
   case SD_CARD_TYPE_SD1

ESP8266_WebServer_Stove.ino: 1574:6: error: 'SD_CARD_TYPE_SD1' was not declared in this scope
   Serial.println("SD1")
ESP8266_WebServer_Stove.ino:1574: note  suggested alternative 




You do need to stay within the Arduino Library Specification when working with libraries but you appear to be doing that. The esp compiler will do whatever it is designed to do. You will see in the output that each file is compiled by calling an .exe in the esp toolchain.
https://arduino.github.io/arduino-cli/library-specification/

You can see in the output you posted which libraries are being discovered and from where. For example:
Code:
Using library Hash version 1.0 in folder "file:///C:/Users/John/AppData/Local/arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/Hash"
 





More info. You wil see these library paths in your output. A few of th 15 libraries you are using

R:/Code/Arduino/libraries/Rtc_by_Makuna
R:/Code/Arduino/libraries/Adafruit_MCP4725
R:/Code/Arduino/libraries/Adafruit_ADS1X15
R:/Code/Arduino/libraries/U8g2
R:/Code/Arduino/libraries/ArduinoJson
C:/Users/John/AppData/Local/arduino15/packages/esp8266/hardware/esp8266/2.7.4/li
braries/SPI
C:/Users/John/AppData/Local/arduino15/packages/esp8266/hardware/esp8266/2.7.4/li
braries/SD
C:/Users/John/AppData/Local/arduino15/packages/esp8266/hardware/esp8266/2.7.4/li
braries/SDFS
C:/Users/John/AppData/Local/arduino15/packages/esp8266/hardware/esp8266/2.7.4/li
braries/ESP8266SdFat
R:/Code/Arduino/libraries/WebSockets


In Visual Micro, you can break the Arduino library location rules and use specific library versions from any location using the checkboxes on the "Add Library" menu however the downside is you loose auto updated when new library versions are released. This auto update or auto discovery is at the heart of Arduino and is recommended. You will see that Arduino allows you to override libraries by putting them in the sketchbook\libraries folder (R:/Code/Arduino/libraries). It is possible that you need a different SD library.




Back to top
« Last Edit: Aug 28th, 2020 at 6:55pm by Visual Micro »  
WWW  
IP Logged
 
johnnyg
Newbies
*
Offline



Posts: 6
Re: Compiler not able to find available files
Reply #5 - Sep 1st, 2020 at 2:33am
 
Hello,

Quote:
It appears the problem is that your ESP8266_WebServer_Stove.ino code attempts to use Sd2Card, SdVolume, SdFile and I guess they don't exist in the esp8266/2.7.4/libraries/SD library? Does this compile using the Arduino IDE?

It won't compile in the Ardunio IDE either.  In all cases up to the second round of v2.7.4, the files do exist but the compiler does not find them. Trying to use absolute paths leads down a rabbit hole, file to file needing more absolute paths when this was not an issue a month ago.

This issue came up when changing board versions.  I've been working on this code for over a year without changing libraries.  After changing board versions this issue arose and reverting back to what I had been using no longer works; same lib versions, same file locations, same includes. I've completely uninstalled VS, VM, and Arduino and will restore the code and libraries to what I had backed up a month ago (again).  I will try the "Add Library" checkboxes next too, I'm thinking the auto update feature may be behind the onset of problems, and would prefer things not change without my knowing.

Regards,
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10821
United Kingdom
Re: Compiler not able to find available files
Reply #6 - Sep 1st, 2020 at 5:54pm
 
Absolute paths are not supported with Arduino. I suggest deleteing these folders and reinstalling board and libraries.

C:/Users/John/AppData/Local/arduino15/packages
R:\Code\Arduino\libraries

Then see it working in a new almost empty project that just references and uses the libs you want to use.

Install the versions that used to work for you then post the output.

Thanks
Back to top
 
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print