Page 1 of 1

Compiling error lecture 7

Posted: Wed Apr 21, 2021 12:06 pm
by CN8ZE
Hi,
compiling arduino code without any modification for lecture 7, i got the following error:


Arduino : 1.8.13 (Windows 10), Carte : "Arduino Uno"

C:\Users\admin\Desktop\ERA\SDR\URCmaterialsV1.0\Scripts\Scripts\Lectures 7&8\Arduino\CC1101_configurable\cc1101_configurable.ino: In function 'void loop()':

cc1101_configurable:40:65: error: cannot convert 'uint8_t** {aka unsigned char**}' to 'char*' for argument '1' to 'int sprintf(char*, const char*, ...)'

sprintf(pckt.data, "This is message number: %03d\n", ++counter);

^

cc1101_configurable:41:29: error: cannot convert 'uint8_t** {aka unsigned char**}' to 'const char*' for argument '1' to 'size_t strlen(const char*)'

int len = strlen(pckt.data);

^

exit status 1

cannot convert 'uint8_t** {aka unsigned char**}' to 'char*' for argument '1' to 'int sprintf(char*, const char*, ...)'

Please help
Thank you

Re: Compiling error lecture 7

Posted: Mon May 10, 2021 1:37 pm
by Lorenzo.Frezza
Dear CN8ZE,
please try to change line 40 of cc1101_configurable to:

Code: Select all

sprintf((char *) pckt.data, "This is message number: %03d\n", ++counter);
and line 41 to:

Code: Select all

int len = strlen((char *) pckt.data);
We cannot reproduce the problem, even though we have the same version of the Arduino IDE, but this edit should fix the problem and will be included in future releases

Lorenzo