- Posts: 271
- Thank you received: 0
Custom halcomp with nested functions halcompile warning: implicit declaration of
10 months 15 hours ago #340739
by NWE
I get around C++ coding some, but this halcomp thing has me confused. I am trying to call several functions within the _ function. As far as I can tell, what I have should work, but when I halcompile it I get these annoying warnings. I know they are just warnings, but I wouldn't mind fixing them.
In other C projects I sometimes use headers, etc, but I'm confused how this works in halcompile.
I searched around some, but can't seem to find examples of how what I'm trying to do would be done in halcomp.
sudo halcompile --install beam_pullmax.comp
Compiling realtime beam_pullmax.c
beam_pullmax.comp: In function ‘_’:
beam_pullmax.comp:213:5: warning: implicit declaration of function ‘y_stop’ [-Wimplicit-function-declaration]
beam_pullmax.comp:241:6: warning: implicit declaration of function ‘y_down_fast’ [-Wimplicit-function-declaration]
beam_pullmax.comp:286:6: warning: implicit declaration of function ‘y_down_slow’ [-Wimplicit-function-declaration]
beam_pullmax.comp:448:6: warning: implicit declaration of function ‘y_up_slow’ [-Wimplicit-function-declaration]
beam_pullmax.comp:467:6: warning: implicit declaration of function ‘y_up_fast’ [-Wimplicit-function-declaration]
Linking beam_pullmax.so
cp beam_pullmax.so /usr/lib/linuxcnc/modules/
Ah Ha! I think I got it! Just include a header file like any old C program...
I guess I'll post anyway now that it is all typed up, in case it saves someone else time on a future project.
In other C projects I sometimes use headers, etc, but I'm confused how this works in halcompile.
I searched around some, but can't seem to find examples of how what I'm trying to do would be done in halcomp.
sudo halcompile --install beam_pullmax.comp
Compiling realtime beam_pullmax.c
beam_pullmax.comp: In function ‘_’:
beam_pullmax.comp:213:5: warning: implicit declaration of function ‘y_stop’ [-Wimplicit-function-declaration]
beam_pullmax.comp:241:6: warning: implicit declaration of function ‘y_down_fast’ [-Wimplicit-function-declaration]
beam_pullmax.comp:286:6: warning: implicit declaration of function ‘y_down_slow’ [-Wimplicit-function-declaration]
beam_pullmax.comp:448:6: warning: implicit declaration of function ‘y_up_slow’ [-Wimplicit-function-declaration]
beam_pullmax.comp:467:6: warning: implicit declaration of function ‘y_up_fast’ [-Wimplicit-function-declaration]
Linking beam_pullmax.so
cp beam_pullmax.so /usr/lib/linuxcnc/modules/
Ah Ha! I think I got it! Just include a header file like any old C program...
I guess I'll post anyway now that it is all typed up, in case it saves someone else time on a future project.
Please Log in to join the conversation.
10 months 13 hours ago #340749
by NWE
Replied by NWE on topic Custom halcomp with nested functions halcompile warning: implicit declaration of
Please Log in to join the conversation.
10 months 12 hours ago #340750
by NWE
Replied by NWE on topic Custom halcomp with nested functions halcompile warning: implicit declaration of
Progress... so I found this:
forum.linuxcnc.org/38-general-linuxcnc-q...ponent-help?start=10
And that is just what I wish to do; it even works. So now all I need to do is figure out what I did different.
Attached a working example for reference.
Wow, this could get interesting, having to reference hal pins by pointer...
And that is just what I wish to do; it even works. So now all I need to do is figure out what I did different.
Attached a working example for reference.
Wow, this could get interesting, having to reference hal pins by pointer...
Please Log in to join the conversation.
9 months 3 weeks ago #341214
by NWE
Replied by NWE on topic Custom halcomp with nested functions halcompile warning: implicit declaration of
I found a seemingly cleaner way: I changed the function names to variables that I set to 1 or 0 at places in the program where I wanted to call the functions.
Then I moved my nested functions to the end of the halcomp and rewrote them into if() checking which variables are set.
My original purpose for functions had been to avoid having duplicate blocks of code each place I want to run that sequence. The if()'s at the end serve my need just as well.
Then I moved my nested functions to the end of the halcomp and rewrote them into if() checking which variables are set.
My original purpose for functions had been to avoid having duplicate blocks of code each place I want to run that sequence. The if()'s at the end serve my need just as well.
Please Log in to join the conversation.
Time to create page: 0.081 seconds
