Simple copy/paste some code to other project does not always work.
Lazarus has plenty of features that help you to debug, that's why I often ask users to share the whole source code.
For your case, I used Ctrl+Cllick. Lazarus showed that you have custom data type in struct.inc that named as rect. Then I searched the Internet, I found rect function is in Classes unit. So, to force the compiler to use Classes unit instead of the custom data type, we just need to add the unit name and a period symbol between them.