cancel
Showing results for 
Search instead for 
Did you mean: 

How to resolve expression must be pointer to complete object type error?

Kanna
Associate III

@TDK​ 

I am getting error in below line in my code

*((uint8_t*)(CB[arr_index].baseaddress + (CB[arr_index].position*sizeof(uint8_t)))) = *((uint8_t*)data);

This error is not occuring when i am using STMCube IDE but when i am imported my project to IAR embedded workbench this line getting error

can anyone please how to resolve this problem and why it is occuring?

1 REPLY 1
KnarfB
Principal III

The opposite of a complete type is an incomplete type. Like in this line, when a definition of my_unknown_struct is neither given nor included.

struct my_unknown_struct *p;

This is a valid definition of two pointer variables. In the sequel

int i = sizeof(p);
p = NULL;
p = q;
*p = 42;

The first three lines are also valid. The compiler knows everything it must know to generate code, e.g. sizeof(p) is 4.

But, the last line triggers an error, for gcc: error: invalid use of undefined type 'struct my_unknown_struct' comparable to yours.

So, the cause is probably that a complete definition of CB is not visible in IAR but in STM32CubeIDE.

hth

KnarfB