-   Linux - Newbie (
-   -   Use of -Wall option in CFLAGS while make for a loadable module (

Ashok_mittal 01-18-2008 06:25 AM

Use of -Wall option in CFLAGS while make for a loadable module
CFLAGS = -Wall -O2 -g -I/usr/nwsdk/include/ -nostdinc -fno-builtin -fpack-struct

this is what we set CFLAGS while making a Makefile ,i read it on different web sources but unable to fully understand the different options like -Wall
If you can give me some tips over this.

anupamsr 01-18-2008 06:32 AM

-Wall : -W represents warnings. -Wall means it will show all possible warnings.
-O2 : means optimize it. These are used in creating machine code from source code by compiler. There are many levels of optimizing. O2 is generally considered good enough, while O3 makes your file size bigger without optimizing significantly, and may make your program slower on some sort of algorithms.
-g means debug. This will add many debugging "notes" in your final binary, so that when you run a debugger on your final binary file, the debugger will know what part of this binary file is related to which part of the original source code.
-I/path/to/include/files : In C/C++, you can include files which compiler already knows where they are present with command: #include <filename.h>. If the compiler does not know where the include file you want to include is present, you can specify the path to that directory with -I/the/directory

Have a look at "man gcc" everything is there.

All times are GMT -5. The time now is 01:15 PM.