Reputation: 303741
I have a simple project - it has a foo.cxx
and a bar.h
:
// bar.h
// nothing
// foo.cxx
#include "bar.h"
// nothing else
If I include bar.h
with ""
s, then the dependency file has everything with its full paths:
$ g++ -std=c++11 -MP -MMD -MF /home/barry/sandbox/foo.d
-c /home/barry/sandbox/foo.cxx -o /home/barry/sandbox/foo.o
$ cat foo.d
/home/barry/sandbox/foo.o: /home/barry/sandbox/foo.cxx \
/home/barry/sandbox/bar.h
/home/barry/sandbox/bar.h:
However, if I include it with <>
s and add -I.
, I just get bar.h
by itself:
$ g++ -std=c++11 -I. -MP -MMD -MF /home/barry/sandbox/foo.d
-c /home/barry/sandbox/foo.cxx -o /home/barry/sandbox/foo.o
$ cat foo.d
/home/barry/sandbox/foo.o: /home/barry/sandbox/foo.cxx bar.h
bar.h:
Is there a way to get the full paths for all of the files?
Upvotes: 2
Views: 753
Reputation: 303741
The issue is with -I.
When gcc is determining the include for <bar.h>
, it will find it as ./bar.h
, and so it will get printed in the dependency file in that same way.
If I were to provide the full path via -I
as well:
$ g++ -std=c++11 -I/home/barry/sandbox -MP -MMD
-MF /home/barry/sandbox/foo.d
-c /home/barry/sandbox/foo.cxx
-o /home/barry/sandbox/foo.o
Then regardless of ""
or <>
, I get the full path of bar.h
in foo.d
, as desired.
Upvotes: 1