- Posts: 723
- Thank you received: 139
custom hal component failed to compile, undeclared (first use in this function)
- smc.collins
- Offline
- Platinum Member
-
Less
More
3 years 10 months ago #259309
by smc.collins
Replied by smc.collins on topic custom hal component failed to compile, undeclared (first use in this function)
line 69 70, etc, its where lock, locked, etc ate called as true false.
undeclared ( first use in function)
undeclared ( first use in function)
Please Log in or Create an account to join the conversation.
- rodw
- Offline
- Platinum Member
-
Less
More
- Posts: 12170
- Thank you received: 4153
3 years 10 months ago #259357
by rodw
Replied by rodw on topic custom hal component failed to compile, undeclared (first use in this function)
I wonder if its the true and false its complaining about? I think they are defined in stdbool.h so they are not loaded.
try up near the top
#define true 1
#define false 0
or
const int true = 1;
const int false = 0;
try up near the top
#define true 1
#define false 0
or
const int true = 1;
const int false = 0;
The following user(s) said Thank You: smc.collins
Please Log in or Create an account to join the conversation.
- smc.collins
- Offline
- Platinum Member
-
Less
More
- Posts: 723
- Thank you received: 139
3 years 10 months ago - 3 years 10 months ago #259366
by smc.collins
Replied by smc.collins on topic custom hal component failed to compile, undeclared (first use in this function)
i was thinking it was a init issue but the documents are murky. I'll give this a try once i get home.
thanks Rodw
I get this error when adding either type of define/declaration. technically this is a bit tied to a pin afaict, but does that make it a pin ? should it be something along the lines of
bit in 1 = true
bit in 0 = false ?
these are generating the errors below.
#define true 1
#define false 0
or
const int true = 1;
const int false = 0;
Cinturnchanger.comp:4:1: Trying to find one of "$", "pin", "param", "function", "variable", "option", "see_also", "notes", "description", "license", "author", "include", "modparam"
thanks Rodw
I get this error when adding either type of define/declaration. technically this is a bit tied to a pin afaict, but does that make it a pin ? should it be something along the lines of
bit in 1 = true
bit in 0 = false ?
these are generating the errors below.
#define true 1
#define false 0
or
const int true = 1;
const int false = 0;
Cinturnchanger.comp:4:1: Trying to find one of "$", "pin", "param", "function", "variable", "option", "see_also", "notes", "description", "license", "author", "include", "modparam"
Last edit: 3 years 10 months ago by smc.collins.
Please Log in or Create an account to join the conversation.
- smc.collins
- Offline
- Platinum Member
-
Less
More
- Posts: 723
- Thank you received: 139
3 years 10 months ago - 3 years 10 months ago #259384
by smc.collins
Replied by smc.collins on topic custom hal component failed to compile, undeclared (first use in this function)
I've checked all the line ending settings, they are all set fo unix/linux with \n
and I am really confused by the () errors, there's nothing at line 80:15, it's white space
~/linuxcnc$ halcompile --compile Cinturnchanger.comp
Cinturnchanger.comp:0: Warning: File contains DOS-style or Mac-style line endings.
Compiling realtime Cinturnchanger.c
Cinturnchanger.comp: In function ‘_’:
Cinturnchanger.c:80:15: error: expected identifier or ‘(’ before numeric constant
#define true (1)
^
Cinturnchanger.comp:73:11: note: in expansion of macro ‘true’
Cinturnchanger.c:82:16: error: expected identifier or ‘(’ before numeric constant
#define false (0)
^
Cinturnchanger.comp:74:11: note: in expansion of macro ‘false’
Cinturnchanger.comp:80:25: error: ‘turret’ undeclared (first use in this function); did you mean ‘true’?
Cinturnchanger.comp:80:25: note: each undeclared identifier is reported only once for each function it appears in
Cinturnchanger.comp:80:32: error: ‘unlocked’ undeclared (first use in this function); did you mean ‘clock_t’?
Cinturnchanger.comp:81:32: error: ‘locked’ undeclared (first use in this function); did you mean ‘clock_t’?
Cinturnchanger.comp:94:25: error: ‘Strobe’ undeclared (first use in this function); did you mean ‘true’?
Cinturnchanger.comp:94:32: error: ‘Switch’ undeclared (first use in this function)
Cinturnchanger.comp:134:26: error: ‘BCD’ undeclared (first use in this function)
make: *** [/usr/share/linuxcnc/Makefile.modinc:115: Cinturnchanger.o] Error 1
and I am really confused by the () errors, there's nothing at line 80:15, it's white space
~/linuxcnc$ halcompile --compile Cinturnchanger.comp
Cinturnchanger.comp:0: Warning: File contains DOS-style or Mac-style line endings.
Compiling realtime Cinturnchanger.c
Cinturnchanger.comp: In function ‘_’:
Cinturnchanger.c:80:15: error: expected identifier or ‘(’ before numeric constant
#define true (1)
^
Cinturnchanger.comp:73:11: note: in expansion of macro ‘true’
Cinturnchanger.c:82:16: error: expected identifier or ‘(’ before numeric constant
#define false (0)
^
Cinturnchanger.comp:74:11: note: in expansion of macro ‘false’
Cinturnchanger.comp:80:25: error: ‘turret’ undeclared (first use in this function); did you mean ‘true’?
Cinturnchanger.comp:80:25: note: each undeclared identifier is reported only once for each function it appears in
Cinturnchanger.comp:80:32: error: ‘unlocked’ undeclared (first use in this function); did you mean ‘clock_t’?
Cinturnchanger.comp:81:32: error: ‘locked’ undeclared (first use in this function); did you mean ‘clock_t’?
Cinturnchanger.comp:94:25: error: ‘Strobe’ undeclared (first use in this function); did you mean ‘true’?
Cinturnchanger.comp:94:32: error: ‘Switch’ undeclared (first use in this function)
Cinturnchanger.comp:134:26: error: ‘BCD’ undeclared (first use in this function)
make: *** [/usr/share/linuxcnc/Makefile.modinc:115: Cinturnchanger.o] Error 1
Last edit: 3 years 10 months ago by smc.collins.
Please Log in or Create an account to join the conversation.
- smc.collins
- Offline
- Platinum Member
-
Less
More
- Posts: 723
- Thank you received: 139
3 years 10 months ago - 3 years 10 months ago #259386
by smc.collins
Replied by smc.collins on topic custom hal component failed to compile, undeclared (first use in this function)
I did a quick copy and paste and wondered if VS code was hiding shit in the white space and geany wasn't cleaning it up. It was. back to reading on numeric constant identifiers in hal. this comp file I started with is old, very old. Would it make more sense o change the true and false to 0 and 1 as that seems to be the more modern hal version identifier for true false on/off ?? thus allowing me to get rid of the additional init issues cause by introducing true false in place of 0/1
halcompile --compile Cinturnchanger.comp
Compiling realtime Cinturnchanger.c
Cinturnchanger.comp: In function ‘_’:
Cinturnchanger.c:80:15: error: expected identifier or ‘(’ before numeric constant
#define true (1)
^
Cinturnchanger.comp:73:11: note: in expansion of macro ‘true’
Cinturnchanger.c:82:16: error: expected identifier or ‘(’ before numeric constant
#define false (0)
^
Cinturnchanger.comp:74:11: note: in expansion of macro ‘false’
Cinturnchanger.comp:80:25: error: ‘turret’ undeclared (first use in this function); did you mean ‘true’?
Cinturnchanger.comp:80:25: note: each undeclared identifier is reported only once for each function it appears in
Cinturnchanger.comp:80:32: error: ‘unlocked’ undeclared (first use in this function); did you mean ‘clock_t’?
Cinturnchanger.comp:81:32: error: ‘locked’ undeclared (first use in this function); did you mean ‘clock_t’?
Cinturnchanger.comp:94:25: error: ‘Strobe’ undeclared (first use in this function); did you mean ‘true’?
Cinturnchanger.comp:94:32: error: ‘Switch’ undeclared (first use in this function)
Cinturnchanger.comp:134:26: error: ‘BCD’ undeclared (first use in this function)
make: *** [/usr/share/linuxcnc/Makefile.modinc:115: Cinturnchanger.o] Error 1
halcompile --compile Cinturnchanger.comp
Compiling realtime Cinturnchanger.c
Cinturnchanger.comp: In function ‘_’:
Cinturnchanger.c:80:15: error: expected identifier or ‘(’ before numeric constant
#define true (1)
^
Cinturnchanger.comp:73:11: note: in expansion of macro ‘true’
Cinturnchanger.c:82:16: error: expected identifier or ‘(’ before numeric constant
#define false (0)
^
Cinturnchanger.comp:74:11: note: in expansion of macro ‘false’
Cinturnchanger.comp:80:25: error: ‘turret’ undeclared (first use in this function); did you mean ‘true’?
Cinturnchanger.comp:80:25: note: each undeclared identifier is reported only once for each function it appears in
Cinturnchanger.comp:80:32: error: ‘unlocked’ undeclared (first use in this function); did you mean ‘clock_t’?
Cinturnchanger.comp:81:32: error: ‘locked’ undeclared (first use in this function); did you mean ‘clock_t’?
Cinturnchanger.comp:94:25: error: ‘Strobe’ undeclared (first use in this function); did you mean ‘true’?
Cinturnchanger.comp:94:32: error: ‘Switch’ undeclared (first use in this function)
Cinturnchanger.comp:134:26: error: ‘BCD’ undeclared (first use in this function)
make: *** [/usr/share/linuxcnc/Makefile.modinc:115: Cinturnchanger.o] Error 1
Last edit: 3 years 10 months ago by smc.collins.
Please Log in or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
-
Less
More
- Posts: 5711
- Thank you received: 2100
3 years 10 months ago #259389
by phillc54
Replied by phillc54 on topic custom hal component failed to compile, undeclared (first use in this function)
I think you may need underscores for the pin names rather than hyphens.
Another thing is that some of the pins you a trying to set are inputs, I think that they can only be set at initialization.
Another thing is that some of the pins you a trying to set are inputs, I think that they can only be set at initialization.
Please Log in or Create an account to join the conversation.
Time to create page: 1.027 seconds