Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Boost.Asio C++ Network Programming

You're reading from   Boost.Asio C++ Network Programming Learn effective C++ network programming with Boost.Asio and become a proficient C++ network programmer

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781785283079
Length 200 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Wisnu Anggoro Wisnu Anggoro
Author Profile Icon Wisnu Anggoro
Wisnu Anggoro
Arrow right icon
View More author details
Toc

Troubleshooting in the GCC C++ compiler

GCC provides several help and diagnostic options to assist in troubleshooting problems with the compilation process. The options that you can use to ease your troubleshooting process are explained in the upcoming sections.

Help for command-line options

Use the help options to get a summary of the top-level GCC command-line options. The command for this is as follows:

g++ --help

To display a complete list of the options for GCC and its associated programs, such as the GNU Linker and GNU Assembler, use the preceding help option with the verbose (-v) option:

g++ -v --help

The complete list of options produced by the preceding command is extremely long—you may wish to go through it using the more command or redirect the output to a file for reference, as follows:

g++ -v --help 2>&1 | more

Version numbers

You can find the version number of your installed GCC installation using the version option, as shown in the following command:

g++ --version

In my system, if I run the preceding command, I will get an output like this:

g++ (x86_64-posix-seh-rev2, Built by MinGW-W64 project) 4.9.2

This depends on your setting that you adjust at the installation process.

The version number is important when investigating compilation problems, since older versions of GCC may be missing some features that a program uses. The version number has the major-version.minor-version or major-version.minor-version.micro-version form, where the additional third "micro" version number (as shown in the preceding command) is used for subsequent bug fix releases in a release series.

The verbose compilation

The -v option can also be used to display detailed information about the exact sequence of commands that are used to compile and link a program. Here is an example that shows you the verbose compilation of the hello.cpp program:

g++ -v -Wall rangen.cpp

After this, you will get something like this in the console:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=C:/mingw-w64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.9.2/configure –
...Thread model: posix
gcc version 4.9.2 (x86_64-posix-seh-rev2, Built by MinGW-W64 project)
...

The output produced by the -v option can be useful whenever there is a problem with the compilation process itself. It displays the full directory paths used to search for header files and libraries, the predefined preprocessor symbols, and the object files and libraries used for linking.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image