This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I'm wondering if GCC automatically defines any preprocessor DEBUG flags when executed with the -g option. For example, when a program compiles on Microsoft Visual C++ in Debug mode, the compiler automatically defines _DEBUG as a preprocessor flag, which can be tested by preprocessor statements like: #ifdef _DEBUG. I'm wondering if GCC does something similar. I devised the attached code to test if GCC does something like this. I compiled using the command: gcc -g -o DebugTest.bin DebugTest.cpp When I ran DebugTest.bin, I received the following output: DebugTest Completed. When I compile and run the same code with Microsoft Visual C++, I get: Uses: _DEBUG DebugTest Completed. So did my test conclusively demonstrate that GCC doesn't automatically define preprocessor DEBUG flags, or am I missing something? (Or should I be using a different -g flag?) Joseph Wagner
Attachment:
DebugTest.cpp
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |