I
I
Ivan Muraviev2020-09-25 10:28:00
GCC
Ivan Muraviev, 2020-09-25 10:28:00

How to use #ifdef in an included file along with the -dN compilation flag?

Actually the question is higher. I have a main.c file in which the file1.c is included, where the #ifdef DEBUG are located. When using this line for compilation: gcc main.c -dDEBUG -o main.exe, the following warning is issued:

Warnings
cc1.exe: warning: unrecognized gcc debugging option: E
cc1.exe: warning: unrecognized gcc debugging option: B
cc1.exe: warning: unrecognized gcc debugging option: G
and ifdef doesn't work. If you change DEBUG to D, nothing changes, except for the absence of warnings.
Is it possible to solve this without changing main.c or do I need to pass some debug flag to the function as an argument?
I found on the Internet that define only works for the current file, but does #include not work before it? The Internet is silent about this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Muraviev, 2020-09-25
@rufus20145

The problem was solved by changing the case -d to -D. Should have read the original documentation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question