"g++ --verbose" - GCC Compiler Steps and Settings

This section provides a tutorial example on how to dump GCC compiler steps and settings using the 'g++ --verbose' command option.

If you are running into issues with the GCC C++ compiler, you may want to use the "g++ --verbose" to dump all current settings from the compiler.

herong$ g++ --verbose hello.cpp

...
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto ...

/usr/libexec/gcc/x86_64-redhat-linux/8/cc1plus -quiet -v -D_GNU_SOURCE hello.cpp
   -quiet -dumpbase hello.cpp -mtune=generic -march=x86-64 -auxbase hello -version
   -o /tmp/cceaNqFM.s
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/8/include-fixed"
ignoring nonexistent directory "/usr/x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...>  search starts here:
 /usr/include/c++/8
 /usr/include/c++/8/x86_64-redhat-linux
 /usr/include/c++/8/backward
 /usr/lib/gcc/x86_64-redhat-linux/8/include
 /usr/local/include
 /usr/include
End of search list.

as -v --64 -o /tmp/ccGgvc09.o /tmp/cceaNqFM.s

COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/8/: ...
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/8/:...

/usr/libexec/gcc/x86_64-redhat-linux/8/collect2 -plugin \
   /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so ...

So the "g++" command actually runs 3 commands: cc1plus, as, collect2.

Table of Contents

 About This Book

 Introduction to Linux Systems

 Process Management

 Files and Directories

 Running Apache Web Server (httpd) on Linux Systems

 Running PHP Scripts on Linux Systems

 Running MySQL Database Server on Linux Systems

 Running Python Scripts on Linux Systems

 Conda - Environment and Package Manager

GCC - C/C++ Compiler

 Install GCC C/C++ Compilers

"g++ --verbose" - GCC Compiler Steps and Settings

 "g++ -I..." and CPATH Environment Variable

 "g++ -l..." to Link with Library Files

 "g++ -c" and "ar src" to Build Static Library

 "g++ -shared" to Build Dynamic Library

 "ldd" - Dynamic Library Dependency Checker

 "make" - Manage Program Build Process

 Graphics Environments on Linux

 Tools and Utilities

 References

 Full Version in PDF/EPUB