As far as I know the mingw64 release we're using has a broken debugger. You'll have to find something which works. I cannot help much, because I don't use windows...
I also doubt mingw-64 will be the cause.
I downloaded x86_64-posix-seh from MinGW-W64 GCC-8.1.0.
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/Entered it as toolchain and debugger at CB (BTW sys.path.insert had a wrong path in it...)
And had exactly the same effect.
Also there is no hint on a bug like this for gdb.
Second I installed CodeLite (guess why!)
and used the mingw from above.
Everything and the debugger worked PERFECTLY.
So it seems to be an error of Code::Blocks again.
I wonder why (after more than a year) I'm the first
to run into it.
Concerning option -g:
The command line is
g++.exe -Wall -fexceptions -g -c D:\Guido\develop\Mist\main.cpp -o obj\Debug\main.o
("Mist" is the German word for "Junk".)