Where you are going wrong is in not posting any relevant information, e.g. which platform you're using, or which compiler, or anything else which might be relevant.