Compiler Flags

Compiler flags are options you give to gcc when it compiles a file or set of files. You may provide these directly on the command line, or your development tools may generate them when they invoke gcc. This section describes just the flags that are specific to Objective-C.

-fconstant-string-class= ClassName

Tells the compiler to create an instance of ClassName for each string literal expressed with the @"string" directive. For the GNU runtime, the default class is NXConstantString; for Cocoa it is NSConstantString.

-fgnu-runtime

Generate code for linking with the standard GNU Objective-C runtime. This is the default option for most gcc installations.

-fnext-runtime

Generate code for linking with the NeXT runtime. This is the default option for Darwin.

-gen-decls

Write all interface declarations the compiler sees to a file named sourcename.decl.

-Wno-protocol

Do not warn if methods required by a protocol are not implemented in the class adopting it.

-Wselector

Warn if there are methods with the same name but different signatures.

Get Objective-C Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.