[C2hs] more problems with c2hs

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Apr 12 20:40:38 EDT 2007


On Fri, 2007-04-13 at 10:17 +1000, Ruben Zilibowitz wrote: 
> Oh, right. I see now. I have renamed file.chs to fileInterface.chs.  
> And left the line #include "file.h" in there. But c2hs  
> fileInterface.chs still gives me errors:
> 
> Attempting to read file `fileInterface.chs'...
> ...parsing `fileInterface'...
> ...successfully loaded `fileInterface'.
> Invoking cpp as `cpp  -x c fileInterface.h > fileInterface.i'...
> powerpc-apple-darwin8-gcc-4.0.1: c: No such file or directory
> powerpc-apple-darwin8-gcc-4.0.1: c: No such file or directory
> powerpc-apple-darwin8-gcc-4.0.1: warning: '-x -x' after last input  
> file has no effect
> powerpc-apple-darwin8-gcc-4.0.1: no input files
> c2hs: Error during preprocessing custom header file
> 
> It seems that cpp isn't happy with: cpp -x c fileInterface.h. It  
> complains about the -x c option. Perhaps this is a bug in the Mac OS  
> X version of cpp. Any ideas?

Ok, try these from the command line and tell us which work:

1. cpp -x -c fileInterface.h > fileInterface.i

2. cpp -x -c fileInterface.h -o fileInterface.i

3. cpp fileInterface.h -x -c > fileInterface.i

4. cpp fileInterface.h > fileInterface.i

5. gcc -x -c -E fileInterface.h > fileInterface.i

6. gcc -E fileInterface.h > fileInterface.i

Perhaps also look in the cpp man page to see if there is anything funny
about the -x option on OSX.

The reason we need the -x c is to tell cpp that this file is a c file
despite the fact that it ends in .h. The same applies to gcc -E.

For example if you find gcc -E -x -c works then you can use that:
c2hs --cpp='gcc -E' file.chs

Duncan



More information about the C2hs mailing list