newbe syntax issues

25 Nov 2015

Hi,

Error: Expression must have pointer-to-object type

I cant fix this error...

in Main

volatile int tx1_in, tx1_out, rx1_in, rx1_out;

char tx1_buffer[400];

in the new module;

extern int tx1_in, tx1_out, rx1_in, rx1_out;

extern const int tx1_buffer, rx1_buffer;

tx1_buffer[tx1_in] = Tx1_byte;

Error: Expression must have pointer-to-object type in "Usart1.cpp", Line: 186, Col: 21

:(

25 Nov 2015

ok, this worked,,

extern const int tx1_buffer[0], rx1_buffer[0];

but now it still fails on the same line.

tx1_buffer[tx1_in] = Tx1_byte;

Error: Expression must be a modifiable lvalue in "Usart1.cpp", Line: 183, Col: 10

:(

25 Nov 2015

Please use <<code>> and <</code>> around your posted code to keep it readable.

The problem is that your declare the array as constant:

extern const int tx1_buffer[0], rx1_buffer[0];

You are not allowed to assign a new value to a constant array. Error: Expression must be a modifiable lvalue in "Usart1.cpp", Says that lefthand side must be a variable and not a constant.

Try for main:

volatile int tx1_in, tx1_out, rx1_in, rx1_out;

char tx1_buffer[400];
char rx1_buffer[400];

Try for module:

extern int tx1_in, tx1_out, rx1_in, rx1_out;

extern int tx1_buffer[], rx1_buffer[];

tx1_buffer[tx1_in] = Tx1_byte;
25 Nov 2015

Hi,

thanks for the pointers,

the reference 0 was one problem, thanks for showing me, but also ' int ' was incorrect. since it is a char array,

adjusting to this fixed it, :)

extern char tx1_buffer[], rx1_buffer[];

thanks again :)