Well, without the error itself, it's a little hard to diagnose :-)
The first thing I would be looking at is whether the "Codevision software" understands the uint8_t
data type. This type was introduced in C99 and it wouldn't surprise me if some embedded development environments still used C90.
It could be a simple matter of including the stdint.h
header. Or, if the compiler doesn't support it, you can use another, compatible data type (possibly unsigned char
).
An easy way to test this is to temporarily change uint8_t
to char
and see if the error goes away (or possibly, moves elsewhere). If it does, then you need to figure out which is the best way to go based on whether uint8_t
is valid for your implementation.
If you're certain it's supported, then show us the actual full error being generated. Without that, we're rather hamstrung.
A few more things to check.
First, it's possible that the text immediately before that declaration may be causing a problem with it. It should be checked as well.
Second (and this is likely in an environment where you mix UNIX/Windows), check the line endings. I've seen issues with Windows-based CR/LF line endings in environments where the compiler expects UNIX-based LF endings.
Comment out the function and see if the error persists elsewhere (such as in the following function). That will give a valuable clue as to the cause (in the function itself, or some environmental problem).
For what it's worth, that code itself is quite valid. The following program compiles okay:
#include <stddef.h>
#include <stdint.h>
void eeprom_write_byte_changed (void *dest, uint8_t ch ) {}
void eeprom_write_block_changes( const uint8_t * src, void * dest, size_t size )
{
size_t len;
for(len=0;len<size;len++)
{
eeprom_write_byte_changed( dest, *src );
src++;
dest++;
}
}
int main(void) {
eeprom_write_block_changes ("hello", NULL, 42);
return 0;
}