Class Method calls to Message() and Clip() get Syntax Error: Unknown Function Label

Tried to use Message(), Clip() and other commands/function in a class method and I get a compiler error
Syntax Error: Unknown Function Label.

I’m guessing I need to include the clarion runtime functions in a class method to get this to work?

If so how?

TIA

Edit.

I can see these are in use in other classes, so why do I get these compiler error messages when I try to use them in a class?

Something is up in your setup somewhere. I use those functions in class methods all the time.
I always have so I have no idea whats wrong.

You are likely in a module that has an empty MEMBER statement
that is MEMBER vs. MEMBER(‘GlobalModule’)

In that case, you need to add a MAP, even an empty one
Like this

  MAP
  END

That is because there is an IMPLIED Include(‘builtins.clw’)
(Edit: EQUATES.CLW is included too)

  MAP
      INCLUDE('BuiltIns.clw'),ONCE
  END 
  INCLUDE('Equates.clw'),ONCE

Several RTL commands including MESSAGE & CLIP are declared in Builtins.clw

Also FYI: the empty map also triggers linking in Win32.lib which is only an issue for small programs that have no MAP.

1 Like

This is correct, it would be helpful if the docs had this info on the help page.

Is this implied builtins something the compiler does?

Yes, this is something the compiler does.

Help[ MAP (declare PROCEDURE prototypes)]
(bold added by me)
"…
A MAP structure is mandatory for any non-trivial Clarion program because the BUILTINS.CLW file is automatically included in your PROGRAM’s MAP structure by the compiler. This file contains prototypes of most of the procedures in the Clarion internal library that are available as part of the Clarion language. This file is required because the compiler does not have these prototypes built into it (making it more efficient). Since the prototypes in the BUILTINS.CLW file use some constant EQUATEs that are defined in the EQUATES.CLW file, this file is also automatically included by the compiler in every Clarion program.

…"

1 Like

When you read the Class help page, it doesnt link to MAP. I know MAP mentions what you have put above, but if you go back to read the Class help page, in C6 anyway, havent check C11, it doesnt link out to MAP, which would be useful.

1 Like

It’s not the Class that needs the MAP it’s the MODULE, which the help on that links to MEMBER that discusses and links to MAP. If the Module is a Member of a Program that has a Map then a local Map is not needed.

Some things you have to learn by getting an error and fixing it. For a compiler to look at bad code and come up with a self evident error message is difficult and often misses the mark.