Skip to content

Instantly share code, notes, and snippets.

@daviddoria
Created December 10, 2016 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daviddoria/0e28d5d39b3a59afaec5f892e67f27c5 to your computer and use it in GitHub Desktop.
Save daviddoria/0e28d5d39b3a59afaec5f892e67f27c5 to your computer and use it in GitHub Desktop.
original
------------
/usr/include/c++/6.1.1
/usr/include/c++/6.1.1/x86_64-pc-linux-gnu
/usr/include/c++/6.1.1/backward
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include
/usr/local/include
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed
/usr/include
(/usr/include is a system directory; the -I argument does nothing.)
cmath is at the path /usr/include/c++/6.1.1/cmath, which is the first element of the search path. math.h can be found in
/usr/include/math.h
/usr/include/c++/6.1.1/math.h
The use of #include_next <math.h> in cmath ensures that the copy of math.h in /usr/include/c++/6.1.1 is skipped and that the copy used is /usr/include/math.h.
With g++ -isystem /usr/include, the search path is
updated
--------------------
/usr/include/c++/6.1.1
/usr/include/c++/6.1.1/x86_64-pc-linux-gnu
/usr/include/c++/6.1.1/backward
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include
/usr/local/include
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed
/usr/include
(/usr/include is a system directory; the -I argument does nothing.)
cmath is at the path /usr/include/c++/6.1.1/cmath, which is the first element of the search path. math.h can be found in:
/usr/include/c++/6.1.1/math.h (the same directory of the cmath we are considering)
and
/usr/include/math.h
The use of `#include_next <math.h>` in cmath ensures that the copy of math.h in /usr/include/c++/6.1.1 is skipped and that the copy used is /usr/include/math.h.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment