I’m working with MVisualC++ 2010 and when I try to undefine the “main”, there’s no result and the console launches as usual. I was expecting some missing entry point error or something.
Why is that?
#undef main
int main()
{
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
main isn’t a
#definein the first place. Your#undefchanges nothing at all.#define foo bartells the preprocessor “replace all occurences of foo with bar”.#undef footells the preprocessor “foo has no special meaning anymore, leave it as is”If you want a linker error, rename
mainto e.g.main2, or do e.g. this:This tells the compiler that a
foofunction exists (but not what it is).maintries to use it, so the linker will give an error when it can’t find it.