Subject:
|
undefined reference to `___ucmpsi2'
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Thu, 18 Jan 2001 11:46:34 GMT
|
Viewed:
|
1440 times
|
| |
| |
I get this error when linking if I have the following in my source code in a
wait_event function:
#define THRESHOLD (unsigned short)50
static wakeup_t light_found(wakeup_t sens_num) {
switch (sens_num) {
case 2:
return (LIGHT(SENSOR_2) > THRESHOLD);
break;
case 3:
return (LIGHT(SENSOR_3) > THRESHOLD);
break;
}
return 0;
}
The following works fine:
static wakeup_t light_found(wakeup_t sens_num) {
if (sens_num == 2)
return (LIGHT(SENSOR_2) > THRESHOLD);
if (sens_num == 3)
return (LIGHT(SENSOR_3) > THRESHOLD);
return 0;
}
Anyone know why?
Thanks
ROSCO
|
|
Message has 1 Reply: | | Re: undefined reference to `___ucmpsi2'
|
| Hi, The problem is that wakeup_t is an unsigned long, and in order to save space, the switch statement is optimized to call a library comparator, ucmpsi2. Since the argument to ds_scale is an unsigned int, the argument to LIGHT should also be an (...) (24 years ago, 18-Jan-01, to lugnet.robotics.rcx.legos)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|