GCC compile debug:print include files and compile stage info.

Source: Internet
Author: User

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:
    1. https://gcc.gnu.org/onlinedocs/
    2. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.