Search code examples
gcccompiler-errorsprecompiled-headers

gcc error: Can't create precompiled header


I have some useful typedefs on a header file called utypes.h. I have decided to use make and haven't found a way to compile it since then.

When I execute gcc -Wall -c utypes.h to generate the .o object of utypes I get the following error:

"utypes.h:1 fatal error: can't create precomiled header types.h.gch: Permission Denied (EACESS)
Compilation terminated.

What am I doing wrong here? Thanks.


Solution

  • You don't have write access to the directory where you are trying to put types.h.gch, or you have a pre-existing read-only copy. On Linux you can use strace to get the details.