I'm sure I'm doing something foolish and I'll feel silly afterwards, but I'm getting an "undefined reference" from the linker when calling a function within the same file! It's obviously not a typo or anything because it's compiling just fine...
So I have a function whose signature looks like this:
int regions_for_time(uint8_t hour, uint8_t minute, uint8_t *regions);
And I define it (of course), and then later in the same file I call it:
void pixels_for_time(time_t time, uint8_t *pixelData) {
uint8_t regions[16];
int num_regions;
num_regions = regions_for_time(0, 0, regions);
...
}
And it compiles, but I get a linker error:
core.cpp.o: In function `pixels_for_time(unsigned long, unsigned char*)':
core.cpp:131: undefined reference to `regions_for_time(unsigned char, unsigned char, unsigned char*)'
collect2: error: ld returned 1 exit status
More confusingly, there's another place in the same file where I call the same function, and it doesn't complain about that one.
Any idea what's going on?