0

C pre processor not processing header files includes in form #include . It gives error: No such file or directory. The files that are included in form #include "header.h" are pre processed properly. How do solve this. I am using command:

cpp -P -I.PWD file.c
Aabha Geed
  • 39
  • 1
  • 11
  • Maybe you mean `-I./PWD`? – Some programmer dude Nov 17 '14 at 11:57
  • Which OS and compiler you use? If PWD means working directory, -I . could be enough, by the way. Also, check that these headers are actually located in that directory. – Ashalynd Nov 17 '14 at 12:06
  • These headers are available in current working directory. -I. works for me. But the cpp command fails only for files with pattern #include – Aabha Geed Nov 17 '14 at 12:29
  • And `` is in the current directory? The one where you're in when you run the command? Then doing simply `-I.` should work. – Some programmer dude Nov 17 '14 at 12:38
  • yes the header is available in the directory. I manually changed <> to "". It gives preprocessed output. But fails if I revert to <> – Aabha Geed Nov 17 '14 at 12:49
  • Are you *really* using `-I.`, or are you doing `-I.PWD` as you show in the question? Those two paths are *very* different! `-I.` adds the current directory, and `-I.PWD` adds the (hidden) directory `.PWD`. – Some programmer dude Nov 17 '14 at 12:53

1 Answers1

0

#include "filename" is different from #include <filename>.
See (What is the difference between #include <filename> and #include "filename"?). `

Gist: #include <filename> does NOT search in ..

Community
  • 1
  • 1
Yunnosch
  • 26,130
  • 9
  • 42
  • 54