I'm doing that when using unit testing, which has its own main, running the test runner. (by #ifndef .. #endif preprocessor block, IIRC).
Report message to a moderator