How to enable compile error highlighting

There have been several questions on this, but they are about bugs with beta versions and the Theia high contrast, which I'm not using (pictured is Theia Dark, but I always use Arduino Dark). This USED to work on my computer as well, but one day it just stopped highlighting errors. Can you help me figure out how to turn this back on?

Hi @Sluice. Please try this:

  1. Select File > New Sketch from the Arduino IDE menus.
  2. Add the following line to the top of the sketch code:
    #error "Oops!"
    
  3. Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to fail.

Do you now see an error highlight on the first line of the sketch?:

image

Yes it does! I tried adding that specific line to my current code and it doesn't show up. ??

I'm going to ask you to post the full verbose output from a compilation.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > New Sketch from the Arduino IDE menus.
  2. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  3. Check the box next to "Show verbose output during: ☐ compilation" in the "Preferences" dialog.
  4. Click the "OK" button.
  5. Add the following line to the top of the sketch code:
    #error "Oops!"
    
  6. Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus.
  7. Select Sketch > Verify/Compile from the Arduino IDE menus.
  8. Wait for the compilation to fail.1. You will see a "Compilation error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  9. Open a forum reply here by clicking the "Reply" button.
  10. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code tags icon on toolbar
  11. Press Ctrl+V.
    This will paste the compilation output into the code block.
  12. Move the cursor outside of the code tags before you add any additional text to your reply.
  13. Click the "Reply" button to post the output.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here:

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a forum reply here by clicking the "Reply" button.
  5. Click the "Upload" icon (Upload icon) on the post composer toolbar:
    Upload icon on toolbar
    A dialog will open.
  6. In the dialog, select the .txt file you saved.
  7. Click the "Open" button.
  8. Click the "Reply" button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

Here ya go:

FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\ajrob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\ajrob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6

loading library from c:\Users\ajrob\Dropbox\Projects\Electronics\Arduino Sketchbook\libraries\Adafruit_NeoPixel-1.11.0: invalid library: no header files found
loading library from c:\Users\ajrob\Dropbox\Projects\Electronics\Arduino Sketchbook\libraries\Servo: invalid library: no header files found
loading library from c:\Users\ajrob\Dropbox\Projects\Electronics\Arduino Sketchbook\libraries\U8G2: invalid library: no header files found
Detecting libraries used...
C:\Users\ajrob\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\ajrob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\ajrob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard C:\Users\ajrob\AppData\Local\Temp\arduino\sketches\CD7F5492B40EDB36579017F1AB41EC0B\sketch\sketch_oct3a.ino.cpp -o nul
Error while detecting libraries included by C:\Users\ajrob\AppData\Local\Temp\arduino\sketches\CD7F5492B40EDB36579017F1AB41EC0B\sketch\sketch_oct3a.ino.cpp
Generating function prototypes...

C:\Users\ajrob\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\ajrob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\ajrob\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard C:\Users\ajrob\AppData\Local\Temp\arduino\sketches\CD7F5492B40EDB36579017F1AB41EC0B\sketch\sketch_oct3a.ino.cpp -o C:\Users\ajrob\AppData\Local\Temp\2587066992\sketch_merged.cpp
C:\Users\ajrob\AppData\Local\Temp\.arduinoIDE-unsaved202393-28708-1jhj4tx.xt5f\sketch_oct3a\sketch_oct3a.ino:1:2: error: #error "Oops!"
 #error "Oops!"
  ^~~~~
exit status 1

Compilation error: #error "Oops!"

It has something to do with the files being in MS OneDrive. I moved the exact same sketch folder/files to my desktop & Dropbox, and the error highlighting worked in both places.

Thanks for taking the time to post an update! Great work finding the cause of the problem. I was suspicious of the path as I noticed it in the screenshot you shared.

I was actually interested in checking for the use of that path in the verbose compilation output I requested. However, I was stumped when I noticed that the path was not present in that output (due to it being from compiling the simple test sketch), even though you reported that you continued to experience the fault even with that simple test sketch.

Is there any fix for this, other than moving the sketch location? These file are for work, and should be in our work project folder at all times for easy shareability.

@Sluice, please help us figure out what's causing the defect. The IDE2 logs would be helpful.

  • Start IDE2 from a terminal. This is an example from my Windows machine with CMD.EXE executed from the IDE2 installation folder:
    "Arduino IDE.exe" --log-level=debug
    
  • Repeat the steps from How to enable compile error highlighting - #2 by ptillisch,
  • Copy the complete terminal output and attach it to this thread.

Thanks!

I do appreciate you guys trying to help on this! So here's what happened.....

I did was you asked by opening up the IDE from terminal, and ever since then, I can't get it to do it again :man_facepalming:t4::man_facepalming:t4:. I moved all my files back into OneDrive, restarted Arduino, OneDrive, & my computer and it's now error highlighting.

The only two things that have changed from now to when it was working are these:

  1. I opened the IDE via terminal via kittakos's method
  2. I reconfigured VScode to work with Arduino so I could use it instead, I modified the cpp_setttings.json to include various library paths, and I did this:

"From some more testing, I guess that the arduino-cli tool when used by VS Code doesn't use the configuration file (arduino-cli.yaml) that is stored in the folder %userprofile%.arduinoIDE by the Arduino IDE 2.0. I copied arduino-cli.yaml from %userprofile%.arduinoIDE\ to %userprofile%\AppData\Local\Arduino15\ and compilation now works."

I have no idea if that is related, but those are the only two things that are different pre & post issue.

Got it to do it again.


C:\Program Files\Arduino IDE>2023-10-06T13:45:08.191Z daemon INFO time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:CMSIS@4.5.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:CMSIS-Atmel@1.1.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:arduinoOTA@1.2.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:arm-none-eabi-gcc@4.8.3-2014q1"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:bossac@1.7.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:openocd@0.9.0-arduino6-static"
2023-10-06T13:45:08.193Z daemon INFO time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:CMSIS@4.5.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:CMSIS-Atmel@1.1.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:arduinoOTA@1.2.0"
2023-10-06T13:45:08.193Z daemon INFO time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:arm-none-eabi-gcc@4.8.3-2014q1"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:bossac@1.7.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:openocd@0.9.0-arduino6-static"
2023-10-06T13:45:08.197Z daemon INFO time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:CMSIS@4.5.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:CMSIS-Atmel@1.1.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:arduinoOTA@1.2.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:arm-none-eabi-gcc@4.8.3-2014q1"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:bossac@1.7.0"
time="2023-10-06T09:45:08-04:00" level=info msg="Required tool" tool="arduino:openocd@0.9.0-arduino6-static"
2023-10-06T13:45:09.462Z daemon INFO time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:CMSIS@4.5.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:CMSIS-Atmel@1.1.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:arduinoOTA@1.2.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:arm-none-eabi-gcc@4.8.3-2014q1"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:bossac@1.7.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:openocd@0.9.0-arduino6-static"
2023-10-06T13:45:09.473Z daemon INFO time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:CMSIS@4.5.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:CMSIS-Atmel@1.1.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:arduinoOTA@1.2.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:arm-none-eabi-gcc@4.8.3-2014q1"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:bossac@1.7.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:openocd@0.9.0-arduino6-static"
2023-10-06T13:45:09.475Z daemon INFO time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:CMSIS@4.5.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:CMSIS-Atmel@1.1.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:arduinoOTA@1.2.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:arm-none-eabi-gcc@4.8.3-2014q1"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:bossac@1.7.0"
time="2023-10-06T09:45:09-04:00" level=info msg="Required tool" tool="arduino:openocd@0.9.0-arduino6-static"
2023-10-06T13:45:09.477Z daemon INFO time="2023-10-06T09:45:09-04:00" level=info msg="Adding libraries dir" dir="C:\\Users\\ajrob\\AppData\\Local\\Arduino15\\libraries" location=ide
time="2023-10-06T09:45:09-04:00" level=info msg="Adding libraries dir" dir="C:\\Users\\ajrob\\AppData\\Local\\Arduino15\\packages\\P1AM-100\\hardware\\samd\\1.6.21\\libraries" location=platform
time="2023-10-06T09:45:09-04:00" level=info msg="Adding libraries dir" dir="c:\\Users\\ajrob\\Dropbox\\Projects\\Electronics\\Arduino Sketchbook\\libraries" location=user
2023-10-06T13:45:09.876Z root INFO Executing 'arduino.languageserver.notifyBuildDidComplete' with "file:///c%3A/Users/ajrob/AppData/Local/Temp/arduino/sketches/7742DEF64D31DF5E1A443A73BCC9E6F1"
2023-10-06T13:45:09.916Z root INFO compiler-errors Current error changed to d;10
2023-10-06T13:45:09.924Z root INFO compiler-errors Handling selection change in editor file:///c%3A/Users/ajrob/AppData/Local/Temp/.arduinoIDE-unsaved202396-2948-16oqnzn.lnvo/sketch_oct6a/sketch_oct6a.ino. New (monaco) selection: [1,2 -> 1,2]
2023-10-06T13:45:11.263Z daemon INFO time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:CMSIS@4.5.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:CMSIS-Atmel@1.1.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:arduinoOTA@1.2.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:arm-none-eabi-gcc@4.8.3-2014q1"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:bossac@1.7.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:openocd@0.9.0-arduino6-static"
2023-10-06T13:45:11.266Z daemon INFO time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:CMSIS@4.5.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:CMSIS-Atmel@1.1.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:arduinoOTA@1.2.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:arm-none-eabi-gcc@4.8.3-2014q1"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:bossac@1.7.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:openocd@0.9.0-arduino6-static"
2023-10-06T13:45:11.271Z daemon INFO time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:CMSIS@4.5.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:CMSIS-Atmel@1.1.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:arduinoOTA@1.2.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:arm-none-eabi-gcc@4.8.3-2014q1"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:bossac@1.7.0"
time="2023-10-06T09:45:11-04:00" level=info msg="Required tool" tool="arduino:openocd@0.9.0-arduino6-static"

@Sluice, thanks for the update :+1:

Does it mean you cannot reproduce the defect anymore? I see you have attached the logs afterward; I do not see anything suspicious in it.

Thanks. They should not matter

Correct. Which VS Code extension do you mean by the way? VS Code itself, for sure, does not use any Arduino CLI config files.

Initially yes, but then it started doing it again. It'll randomly work 1 or 2 times, but the rest of the time it will not work with onedrive. The logs I posted are from when it wasn't working. I wish it were a more stable issue

I can propose the following if you are willing to continue the investigation: I will create a tester build with super verbose logging only for this use case, and you can try out if you can reproduce the bug. When you hit the defect, the additional logging hopefully helps. If you're in, I will create a build for you in the next few days (this weekish) and ping you here. Currently, I do not have a better idea. Let me know what you think. Thanks!

That sounds great! Thank you for taking so much time to work on this!

@Sluice, I created fix: additional logging for compiler error parsing by kittaakos · Pull Request #2256 · arduino/arduino-ide · GitHub.

I prefer moving the conversation there. I have no problem with the forum, but I visit this channel less frequently.

Please read the PR description; it contains a link to a guide on downloading and testing the beta IDE2. Please note, that it's not a fix, but the first step to find the problem.

Thank you for your support.

Hi @Sluice. Did you ever try the special build of Arduino IDE that was produced by kittaakos for the purpose of troubleshooting the problem you experienced?

If so, please provide the logs generated by that build so we can proceed with the investigation.

If you have any questions or problems while installing or using the build, just let us know and we'll be happy to provide assistance.

I did not! I've been having so many other troubles I completely forgot about this one :D. I'll get on this next week.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.