I'm by no means a VC++ expert, but it's possible that its "Release" mode expects some tests to be done (and so, warnings to be suppressed) before allowing some functions to run.
Here for instance, you don't test the existence of the file before using it. Have you looked at functions like g_file_query_exists () ?