unknown type name ‘bit’

More
23 May 2025 09:42 #328967 by Z3rni3
unknown type name ‘bit’ was created by Z3rni3
Hey Guys
I'm trying to write a function at the moment but it does'nt accept me using a bit.
Probably jsut missing something small.
I get following Error with following function;

CODE:
pos_latch.c:29:5: error: unknown type name ‘bit’
   29 | bit last_Tin;
        | ^~~
make: *** [/usr/share/linuxcnc/Makefile.modinc:117: pos_latch.o] Error 1


FUNCTION:
component pos_latch;
license "GPL";

pin in float Pin;
pin in bit Tin;
pin out float out;

variable bit last_Tin = FALSE;

function _;

;;

FUNCTION(_) {
    if (Tin && !last_Tin) {
        out = Pin;
    }
    last_Tin = Tin;
}

 

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

More
23 May 2025 09:48 #328968 by Hakan
Replied by Hakan on topic unknown type name ‘bit’
Name the file pos_latch.comp, the comp thing makes it go through the preprocessor.

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

More
23 May 2025 10:45 - 23 May 2025 10:51 #328970 by Z3rni3
Replied by Z3rni3 on topic unknown type name ‘bit’
I acctually name it pos_latch.comp when creating the document.


I've created working functions before but those only used floats.
Follwing File installs no problem...:
component Test;
license "GPL";

pin in float in;
pin out float out1;
pin out bit out2;

function _ nofp;

;;

FUNCTION(_) {
out1 = in * 3;
if (out1 == 3.0)
   { out2 = true; }
else
   { out2 = false; }
}

 
Last edit: 23 May 2025 10:51 by Z3rni3.

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

More
23 May 2025 10:58 #328971 by cmorley
Replied by cmorley on topic unknown type name ‘bit’
try:

variable int last_Tin = 0;

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

More
23 May 2025 11:07 #328972 by Z3rni3
Replied by Z3rni3 on topic unknown type name ‘bit’
I was able to install it now, thank you!
Will update if it works as planed.

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

Time to create page: 0.079 seconds
Powered by Kunena Forum