Using valid directory as a fake "compiler installation directory" helped with the initial "Compiler auto-detection". Thank you.
I would still consider this a sort-of workaround, though. Shouldn't this assumption about "bin" subdirectory, "compiler master directory", etc., be considered a CodeBlocks flaw, reported to devs somewhere, and fixed?
As for the GCC error, I dug deeper and found out what's the problem. In the .cbp project file, there is some sort of compiler setting for entire project, not just for each target. In my case it looks like this:
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="..." />
<Option compiler="gcc" /> <------ This line
<Build>
<Target title="wx31-gtk2-debug">
<Option platforms="Unix;" />
...
<Option compiler="gcc" />
...
</Target>
<Target title="wx31-gtk2-release">
<Option platforms="Unix;" />
...
<Option compiler="gcc" />
...
</Target>
<Target title="wx31-msw-debug">
<Option platforms="Windows;" />
...
<Option compiler="microsoft_visual_c_2019" />
...
</Target>
<Target title="wx31-msw-release">
<Option platforms="Windows;" />
...
<Option compiler="microsoft_visual_c_2019" />
...
</Target>
... etc ...
If I delete the line from project file, CodeBlocks puts it back there when I open the project. However, if I change the line to <Option compiler="microsoft_visual_c_2019"/>, then the error about missing GCC disappears.
I don't know what this line is supposed to mean, or how it can be edited via CodeBlocks GUI. Any idea what it is, and what to do about it?