That sounds suspiciously like your code is invoking undefined behaviour somewhere. If so,
a) symptoms are not expected to be consistent between OSes, OS versions, and linking (including debugging) options - or even within them!
b) it may well be impossible to tell where it does so, on this forum, because it's a programming problem, not a Code::Blocks one. You'll need to ask in a more specialised forum, such as StackOverflow.
Sorry.