What are the gcc system include paths?

The #include preprocessor directive in c++ is one of the first things that people learn. They come in two varieties:

  1. #include<> – usually meant for system-level includes such as iostream or other headers from libraries installed at the system level.
  2. #include " " – usually meant for files included from a location relative to the code being written… for instance, another header file for a class you just wrote.

But, where are system level headers stored?  On Linux with the gcc tool chain installed, you can execute the following command to find out:

g++ -E -x c++ - -v < /dev/null

  • -E – Stop after the pre-processing step
  • -x c++ – language of interest is c++
  • -v – verbose output

In the output, look for the section that starts with #include <...> search starts here.  A collection of paths is listed after this line which is where the pre-processor will look for any includes that are in <...> (angle brackets).

FWIW, there’s also a way to include additional paths to be used as system includes on the command line when compiling code.

Customizing CLion

Clion Logo

Some folks get a lot of enjoyment out of tweaking the UI of a piece of software.  In an IDE like CLion, the color scheme used for the code editor is highly customizable.  If you'd like to explore the settings and/or find a new theme for CLion or just … [Continue reading]

Docker and MySQL

Containers are all the rage, and Docker is the container engine of choice these days.  So, I wanted to provide this tutorial for setting up a MySQL server instance in a Docker container. … [Continue reading]

Spring 2019 Help Desk Schedule

The Spring 2019 Help Desk Schedule... … [Continue reading]

Linux, C++, and Libraries like myHTML

Whenever you write c++ code for a project, have you ever wondered where the actual implementations for iostream's << and >> operators are?  What about the implementations for all of the algorithms that are in the algorithm header? … [Continue reading]

Customizing Shell in your Terminal

I use  the terminal to do quite a bit on both my Mac laptop and Linux desktop.  Sometimes its easier to hammer out a shell command than it is find the right context menu or menu item to click to do something. On Linux, I use Guake Terminal and … [Continue reading]

Java – Exam Stats Example

This post is another in the series of small Java Programs and their evolution.  The scenario for the program today, Exam Statistics, is calculating a couple statistics for a set of grades entered by the user. You can see in the code below, I work on … [Continue reading]

Time for some Java

Let's take a simple program idea and refine it over the course of a few versions of the code.  The program we are writing is meant to print a box made of asterisks.  The width and height of the box is based on a value entered by the user.  For … [Continue reading]

Weimar 2018 – Photo Scavenger Hunt

Follow the Traces of History in Weimar Your Task: Find 15 of the following places and take a picture of your group in front of the historical monument. (Hint: don’t visit the places in the sequence they appear here). The Prize: Dinner with Dr. … [Continue reading]

Testing More than One Thing with Catch

In a modern piece of software, you wouldn't have tests for just one class.  You'd have exhaustive tests for all the functionality in your program.  However, it would be challenging to put all of the tests in one single tests.cpp file.   … [Continue reading]