Author Topic: Arduino .ino files  (Read 3915 times)

StephenW

  • Senior Community Member
  • Posts: 197
  • Hero Points: 21
Arduino .ino files
« on: April 01, 2019, 05:39:19 AM »
I am doing my first Arduino project, and I have run into a problem with the .ino files that Arduino uses.  These are "sketch" files supported by their IDE and toolchain, but they are actually just C++ files.  I prefer to use SlickEdit, rather than their IDE, so I added *.ino to the settings for what files are C/C++ files, and that mostly worked.  But there is still one place that *.ino is not working.  When I build my project and there are compile errors, the error messages produced by the GCC compiler only give the file name, without extension.  And SlickEdit then tries to find a matching *.c or *.cpp or similar file to match that name.  It does not look for an *.ino file, and I have not found any way to change how that works.  Is there some configuration option I have not found, or do I need to start digging through the macro source to see if I can fix it there?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Arduino .ino files
« Reply #1 on: April 08, 2019, 07:10:52 PM »
Do these error messages ever contain a file extension?

If these error message can be uniquely identified (differentiated from others), please post a sample. Maybe a new error parsing regex could be added to your configuration.

I don't think SlickEdit has a list of extensions it attempts to append to error message filenames that are missing an extension but I could be wrong.

StephenW

  • Senior Community Member
  • Posts: 197
  • Hero Points: 21
Re: Arduino .ino files
« Reply #2 on: April 09, 2019, 08:30:31 AM »
I have learnt a bit more about how the Arduino tools work.  It seems there is a preprocessor pass that creates a temporary file with the .ino.cpp extension, from the .ino file.  The .ino.cpp file has appropriate #line preprocessor lines added to it so that it retains the correct line number information from the .ino file.  Errors and warnings in other files (library .cpp files, or .h files for example) get the file extension in the error message and SlickEdit finds the correct file.  It seems to be only errors in the .ino file that do not get a file extension.  I have attached the output of a recent build that has an example of both.  SlickEdit pops up a window asking where to find the correct file for errors in the .ino file, but it does not allow me to tell it the correct file name, just the directory to look in.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Arduino .ino files
« Reply #3 on: April 09, 2019, 12:41:25 PM »
Somebody messed up this tool.

Changing the error parsing regex isn't a great solution due to ambiguities. A list of extensions to try if the filename has no extension is best.

Here's a work around but you'll need v23.0.1

Load the attached macro  with Macro>Load Module...

Set the macro variable "def_next_error_try_ext_list" to ".ino".  Macro>Set Macro Variable...

This should do the trick.

StephenW

  • Senior Community Member
  • Posts: 197
  • Hero Points: 21
Re: Arduino .ino files
« Reply #4 on: April 10, 2019, 04:52:26 AM »
Thank you, that is much better.  The next error function is working!  But it looks like there is somewhere else that needs the same fix.  When I double click on an error line applying to the .ino file, I still get the popup window asking where to find it.  And the little red X icons on the left of the main window for the errors lines are not appearing in the .ino file - they actually appear at the end of other files.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Arduino .ino files
« Reply #5 on: April 10, 2019, 12:23:16 PM »
I’ll see if that can be tweaked too.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6823
  • Hero Points: 526
Re: Arduino .ino files
« Reply #6 on: April 10, 2019, 01:32:25 PM »
These changes should handle the other cases.

Just load this new version of the module. You should need to set the macro variable again.

StephenW

  • Senior Community Member
  • Posts: 197
  • Hero Points: 21
Re: Arduino .ino files
« Reply #7 on: April 10, 2019, 02:44:20 PM »
Many thanks, the error message handling is all working nicely now.

markeby

  • Junior Community Member
  • Posts: 6
  • Hero Points: 0
Re: Arduino .ino files
« Reply #8 on: April 16, 2022, 09:08:19 PM »
How did you implement the Arduino command line tool to work? My first attempt is by batch file with an error check between compile and upload. It would be nice if there was a simple way to implement the compiler with the integrated calls.

SidInNJ

  • Junior Community Member
  • Posts: 5
  • Hero Points: 0
Re: Arduino .ino files
« Reply #9 on: July 26, 2022, 01:30:53 PM »
Under Project Properties, Tools, Build, Command Line:
Code: [Select]
arduino-cli compile -p COM22 -u -t --fqbn arduino:avr:mega  --warnings more myProject\myProject.ino
My SlickEdit project is located in the folder holding the Arduino project and "libraries" folders. The file arduino-cli.yaml is also in that folder.
Code: [Select]
board_manager:
  additional_urls: []
daemon:
  port: "50051"
directories:
  data: C:\Users\me\AppData\Local\Arduino15
  downloads: C:\Users\me\AppData\Local\Arduino15\staging
  user: .
logging:
  file: ""
  format: text
  level: info
telemetry:
  addr: :9090
  enabled: true
PS. Sorry I didn't see this question sooner....