The following command prints the absolute path for a specific C ++ header, according to how g ++ considers this.
echo \#include\<ham/hamsterdb.h\> | g++ -M -x c++-header - | grep hamsterdb.hpp | sed -e 's/-: //' -e 's/ \\//'
On my system, these outputs are: /usr/local/include/ham/hamsterdb.hpp
I ran into a problem while trying to run this inside a Makefile to set a variable:
FILE=$(shell echo \#include\<ham/hamsterdb.h\> | g++ -M -x c++-header - | grep hamsterdb.hpp | sed -e 's/-: //' -e 's/ \\//') .PHONY spec spec: @echo $(FILE)
This prints a new line. I think this is a hash ('#') character that messes with make; if I rewrote the string FILE=... as follows:
FILE=$(shell echo \#include\<ham/hamsterdb.h\>)
the conclusion is still nothing.
source share