1

I would like to pass certain options to the compiler such as -Wall. The IDE I am working in makes it difficult to change the flags repeatedly, hence I would like to pass the compiler option from within the source file itself.

Is this possible via a preprocessor directive or a hack of some sort (restricted to the source code to be compiled)?

For example, say I want to compile a program with the -Wall and I do not have access to the arguments being passed to gcc from the IDE. I would like to do something like #<directive> WALL that the preprocessor looks for and enables for the compilation process.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
asheeshr
  • 4,088
  • 6
  • 31
  • 50
  • 2
    I think there is a similar question already... http://stackoverflow.com/questions/3731885/add-gcc-options-to-top-of-c-source-file – Ruslan Feb 15 '14 at 03:42
  • 2
    Do you not have access to a makefile? Especially on Linux, that's the typical place to control compiler options. – Rob Kennedy Feb 15 '14 at 03:45

0 Answers0