[C2hs] more problems with c2hs

Ruben Zilibowitz rubenz at cse.unsw.edu.au
Thu Apr 12 20:17:53 EDT 2007

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?


On 13/04/2007, at 10:04 AM, Duncan Coutts wrote:

> On Fri, 2007-04-13 at 09:49 +1000, Ruben Zilibowitz wrote:
>> Thanks for pointing to the appropriate mailing list. This is what
>> appears to be happening.
>> file.chs has a line: #include "file.h"
>> After running:
>> c2hs file.chs
>> file.h gets modified so that it contains just:
>> #include "file.h"
>> So I lose the contents of file.h every time I run c2hs!
> Yes, this file is generated by c2hs from the things you put in  
> the .chs
> file (like #include and other cpp stuff, #if and the like).
> So you can't modify that .h file yourself. Also, you cannot #include
> "file.h" inside "file.chs" because that'll generate a "file.h" file  
> that
> recursively #includes itself!
> Personally, I think it's very bad behaviour that the file is called  
> the
> same as the .chs file but with a .h extension, since this is  
> exactly the
> name of a file that many people will want to include. I intend to  
> change
> it to use file.chs.h or something similar that will not clash.  
> (Also I'd
> like to not generate any .chs.h file in the common case of just
> #including a single .h file.)
> Duncan

More information about the C2hs mailing list