Failure to find Named Subroutines

More
09 Jan 2026 20:44 #341219 by roycegb
Failure to find Named Subroutines was created by roycegb
I have always had problems with named subroutines but lately I cannot get them to work at all.I get the following message;

LinuxCNC Error Near line 4 of/home/rpi-first-boot-wizard/linuxcnc/nc_files/Utility_G_Code/test.ngc:Failed to find sub 'Omyfile.ngc' before EOF

In this case I had a dead simple routine named 'test.ngc' that called a dead simple subroutine named 'my file.ngc'.

The location of the files and subroutines was called out in the .init file.

I have used named subroutines in the past.  I now use Raspberry Pi 4 and 5 with Axis 2.9.4 versions.

Any fool proof method for handling these subroutines would be appreciated.
I have a boat load of specializedsub routines lying dormant.
Attachments:

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
09 Jan 2026 20:55 #341220 by tommylight
Replied by tommylight on topic Failure to find Named Subroutines


In this case I had a dead simple routine named 'test.ngc' that called a dead simple subroutine named 'my file.ngc'.

No idea if this is the issue, but easy to test so:
-no spaces in file names, this was an issue way back, not sure if it still is
-use a file name like: my_file.ngc

Please Log in or Create an account to join the conversation.

More
09 Jan 2026 22:09 #341222 by MaHa
Replied by MaHa on topic Failure to find Named Subroutines
The name must always match

file:
myfile.ngc

in the subroutine:
o<myfile> sub
  some code
o<myfile> endsub

call the sub:
o<myfile> call
 
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
10 Jan 2026 21:17 #341249 by roycegb
Replied by roycegb on topic Failure to find Named Subroutines
tommylight;
The space in the original post was a typo. my file.ngc, no spaces.

MaHa;
I tied identical names with and without the .ngc suffix everywhere with no luck.

The attachment shows the result with all data shown as suggested.

I am suspicious that the program seems to be looking for 'Omyfile'   instead of simply O  'myfile'.  Could it be a parsing problem?

Thanks,
Royce

Please Log in or Create an account to join the conversation.

More
10 Jan 2026 21:57 #341250 by MaHa
Replied by MaHa on topic Failure to find Named Subroutines
The percent sign %  in the calling routine could cause that error. Capital letters for the naming in the routine, maybe too

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
10 Jan 2026 22:16 #341253 by tommylight
Replied by tommylight on topic Failure to find Named Subroutines
Do those files need to be executable?

Please Log in or Create an account to join the conversation.

Time to create page: 0.087 seconds
Powered by Kunena Forum