Issue
How do I at compile time undefine a compiler macro using GCC? I tried some compile arguments to GCC, like rel="nofollow noreferrer">-D, but I can't get to see the "not defined" message.
#include <iostream>
#define MYDEF
int main(){
#ifdef MYDEF
std::cout << "defined\n";
#else
std::cout << "not defined\n";
#endif
}
Solution
You can use the -U option with GCC, but it won't undefine a macro defined in your source code. As far as I know, there isn't any way to do that.
Answered By - dcp Answer Checked By - Marilyn (WPSolving Volunteer)