Hi I'm going to try and post a link to a screenshot video that shows what happens (see below), but basically, a large project that has been compiling perfectly until today, now gives an error if I even add a blank line before my first #include statement.
If the video link works you'll see it compile perfectly, then I simply hit return to add a blank line and now the compiler gives me an error:
F:\Documents\GitHub\projectX-firmware\Project-X\Project-X.ino:314:10: fatal error: Adafruit_GFX.h: No such file or directory #include <Adafruit_ILI9341.h> // Hardware-specific library for ILI9341 driver chip
^~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: Adafruit_GFX.h: No such file or directory
For informed help, please read and follow the instructions in the "How to get the best out of this forum" post, linked at the head of every forum topic.
Navigate to the directory that you find at the end; in the above C:\Users\Wim\AppData\Local\Temp\arduino\sketches\8F281D757AB5309FCC8D41A31AAAB3F1\
Zip the sketch directory and post it here in a reply.
This will give us a unmodified version of what is actually being compiled and maybe we can find something.
I'm not a specialist but I can have a look.
Which operating system are you using?
Note if you're using Windows: the AppData directory is normally hidden; you need to enable "Show hidden files, folders and drives" under options in File explorer.
Keep calm, try to suprime temporaly the lines with comments. Try differents things like paste all the code in notepad, create a new sketch and paste it again. In the middle restart the machine.
It is an IDE bug, just pointers in RAM related with the lines order in the precompilation step.
I think I encountered the same problem, I don't know what I did to fix it though. For complex projects I use Eclipse anyway, so maybe I just gave up with the IDE on that one.
@mol13 Hi. I read your original thread and tried your MCVE but it actually compiled ok once I installed the required libraries!
What do you mean by suprime temporarily the lines with comments?
I do have a big comment block inside /* ... */ with my change log before the #includes. I found the error today (after two+ years of no problems with developing this project!) when I added a new comment to the block.
I will take the sketch you have posted and I will try to fix the problem. If i get it I will ping you.
"Temporaly" means, cut and paste in other txt in order to back it up, and after a few dat when you have changed something more and the sketch compiles OK, put the comments again.
Also try to divide in several // intead of /../
It's thousands of lines and multiple source files!
I have just run a diff check on the ino.cpp files for before and after I add the blank line that gives the error and what is missing in the 'bad' file is all of the function prototype declarations:
I think if you put a lot of line blanks, the error will change over differents elements in the sketch. In my case it was over #includes and and #defines.
Yes that does seem to happen with me too. The line that throws up the error changes depending on how many extra lines or comments I add before the first #include. It's a very strange bug!
If I put in a new comment line in my changelog comment block, I have to delete one of the blank lines I added, otherwise the error comes back. I think I will try moving all the #include statements to the start of the file, before my comment block.
Update: moving all the includes above the comment block was successful. Otherwise, when the includes were after the comments I had to add just enough blank lines, one more or one less and the error came back.
It's not actually solved! This is a bug in the IDE/Compiler and all we've found is a workaround for now. Other users will probably hit the same problem at some stage so it needs a proper fix.
I think it´s relative, I agree with you but since we are not Arduino developers, we cannot solve the bug. In terms of compilation you can compile your sketch now, and the Solved mark encourages other people to read.
The important thing here is your work so I´m glad to help.
It´s up to you, anyway.
You're correct, we got to where we could continue our projects! Thanks for your help.
By the way, I still don't understand your word 'suprime'. I think you mean that you cut the comments, pasted them into a text document that you saved, then you saved your Arduino code, and, a few days later, you copied and pasted the comments back to the code and it then compiled?
In my case I moved all the #includes to the start of the file before the comments and that worked!.