[C2hs] more problems with c2hs
Ruben Zilibowitz
rubenz at cse.unsw.edu.au
Thu Apr 12 21:09:27 EDT 2007
All these seemed to work except for 2. In the c2hs output it says:
cpp -x c ...
not:
cpp -x -c ...
I think that might be a key issue.
Ruben
On 13/04/2007, at 10:40 AM, Duncan Coutts wrote:
> 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