I remember having this problem long ago, around 2003? How did I get it at last? I know the source code must be right since this has been unchanged (copied from the text book,🙂 ). But why? Finally, I found that you have to change the program setting from “Single thread debug” to “Multi-threaded“. Just that simple.
It is logged here in case I forget it again.