Sample Code:
#include <stdio.h>#include <stdlib.h>externvoid foo() __attribute__((weak));int main() { if (foo) foo(); printf("this is a test\n");}
Compile command:
-H-v sample.
Compile options:
-H tells you, the right include files (in/usr/local/) is used.
Official Document:
Print the name of each header file used, in addition to other normal
Activities. Each name was indented to show how deep in the ' #include '
Stack it is. Precompiled header files are also printed, even if they
is found to be invalid; An invalid precompiled header file is printed
With ' ... x ' and a valid one with ' ...! '.
-V (or even maybe-wl,-v) tells you, the right libraries (in/usr/local/) is used.
Official Document:
Print (on standard error output) the commands executed to run the
Stages of compilation. Also Print the version number of the compiler
Driver program and of the preprocessor and the compiler proper.
Sample output:
..... ..............
/usr/include/x86_64-linux-gnu/bits/waitflags.h
/usr/include/x86_64-linux-gnu/bits/waitstatus.h
/usr/ Include/x86_64-linux-gnu/gnu/stubs-64.h
/usr/include/x86_64-linux-gnu/gnu/stubs.h COLLECT_GCC_OPTIONS= '-O '
' Hello ' '-h '-V '-mtune=generic '-march=x86-64 ' as-v–64-o
/tmp/ccwd1dya.o/tmp/cc8cu0iv.s GNU assembler ve Rsion 2.24
(X86_64-LINUX-GNU) using BFD version (GNU Binutils for Ubuntu) 2.24
compiler_path=/usr/lib/gcc/x86_64 -linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64- linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
library_path=/lib/x86_64-linux-gnu/:/lib/. /lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/. /.. /.. /x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/. /.. /.. /.. /lib/:/lib/x86_64-linux-gnu/:/lib/. /lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/. /lib/:/lib/:./:/usr/lib/gcc/x86_64-linux-gnu/4.8/. /.. /.. /:/lib/:/usr/lib/
........
REF:
- https://gcc.gnu.org/onlinedocs/
- Http://stackoverflow.com/questions/28563263/c-compiling-errors-on-debian
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
GCC compile debug:print include files and compile stage info.