Tim, thanks for your reply.
My version of Codeblocks is 20.03.
Your suggestion solves my problem.
I noticed however that it is not necessary to add "Use C ++ compiler" in the linker options when using Codeblocks as administrator ie running "sudo Codeblocks".
The problem is reproducible with two simple files, one in C and the other in C ++.
Stefano