After I read this question, I agreed with you, but the editor has a point. The OP of the SO question said that his code worked, but the code he posted didn't even compile. Therefore, the code he posted isn't the code he was using.
He later admitted as much in a comment:
I'm sorry for that, I have modified the source since I compiled it. Nothing too major should be changed
I'm not accusing him of anything malicious, but he's obviously confused — he's asking a question on SO, after all — so it's probable that some change that seemed minor to him actually had major effects.
This should probably be analyzed in the general case, though, not this specific one.
On the one hand, providing some code is certainly better than providing no code. Even non-working code gives a basic idea of how the asker is approaching the problem. However, if we don't know the differences between the code the OP used and the code the OP posted, it's going to be hard for us to solve the problem. If we find an issue, is it the one that caused the problem originally, or something that was introduced afterwards? In this sense, posting changed code is not that different from "I need to do X in Java. Here's some Haskell code that solves another problem entirely."