There is no way to prevent Code::Blocks from doing that, since it is done by wxWidgets implicitely if you use wxTempFile (and on a "normal" filesystem it would work, too).
If that helps, you can suppress the error message (and all other error messages related to saving!) by adding the line:
wxLogNull null_logger;
in sdk/globals.cpp, at line 433.
Please do not ask for this being added to the code base, though. It will not be.
Be aware that you will not get any error messages if saving a file fails entirely (for whatever reason) with this modification. It may, however, still be a viable option in your specific case.
Yet another alternative might be to replace the wxTempFile with a normal wxFile. This requires a few other lines to be changed too, and will prevent your specific error from happening, but will still report other failures.
This solution is unsafe and may result in loss of data, for example in case of a power loss or an application crash while saving. We use wxTempFile for that reason.