Works for me. I suspect you have the wrong version of gcc. You now need 10.2.1
I’m using 10.3-2021 version
It is normal for me to use the previous version, but there is a small error
Therefore, I have to change to the following code：
You must use the exact version supported by ardupilot.
The code above all works, why did you think you needed to change it?
It cannot be compiled with the same gcc version
Please use the correct gcc version