Trouble compiling a simple program

Andrew Robert arobert at townisp.com
Tue Mar 2 22:32:13 UTC 2004


Rather than specify specific linux header files, I recommend you use

#include <stdlib.h>
#include <stdio.h>


Bevan C. Bennett wrote:

> Todd MacDermid wrote:
>
>> Hey all, I appear to be having an issue compiling a simple program
>> under Fedora Core 1. the program is as follows:
>>
>> #include <linux/ip.h>
>> #include <stdio.h>
>>
>> int main() {
>>
>>   printf("Foo\n");
>>   return(0);
>> }
>>
>> And attempting to compile it gives me:
>>
>> [tmacd at bahamut src]$ gcc -g -O2 -Wall -c test.c In file included from 
>> test.c:1:
>> /usr/include/linux/ip.h:95: parse error before `__u8'
>> /usr/include/linux/ip.h:95: warning: no semicolon at end of struct or 
>> union
>> /usr/include/linux/ip.h:101: warning: data definition has no type or 
>> storage class
>> /usr/include/linux/ip.h:102: parse error before `tot_len'
>> /usr/include/linux/ip.h:102: warning: data definition has no type or 
>> storage class
>> /usr/include/linux/ip.h:103: parse error before `id'
>> /usr/include/linux/ip.h:103: warning: data definition has no type or 
>> storage class
>> /usr/include/linux/ip.h:104: parse error before `frag_off'
>> /usr/include/linux/ip.h:104: warning: data definition has no type or 
>> storage class
>> /usr/include/linux/ip.h:105: parse error before `ttl'
>> /usr/include/linux/ip.h:105: warning: data definition has no type or 
>> storage class
>> /usr/include/linux/ip.h:106: parse error before `protocol'
>> /usr/include/linux/ip.h:106: warning: data definition has no type or 
>> storage class
>> /usr/include/linux/ip.h:107: parse error before `check'
>> /usr/include/linux/ip.h:107: warning: data definition has no type or 
>> storage class
>> /usr/include/linux/ip.h:108: parse error before `saddr'
>> /usr/include/linux/ip.h:108: warning: data definition has no type or 
>> storage class
>> /usr/include/linux/ip.h:109: parse error before `daddr'
>> /usr/include/linux/ip.h:109: warning: data definition has no type or 
>> storage class
>> [tmacd at bahamut src]$
>> This is just an example of a problem that's been keeping me from 
>> compiling
>> a more complex program, which compiled under RH9, but doesn't compile
>> due to header file problems under Fedora. Is there a prerequisite to
>> including linux/ip.h, or am I hitting some other issue?
>>
>> Any insight is much appreciated,
>
>
> Add:
> #include <linux/types.h>
>
> and it should be fine.
>
> linux/ip.h should probably include it itself.
> It wasn't in bugzilla, so I added it.
>
>


-- 
Thank you,
Andrew Robert
Principal Systems Analyst
TS&S Infrastructure Support - OpenVMS
Massachusetts Financial Services
Phone:  (617) 954-5882
Pager:  (781) 764-7321
E-mail: arobert at mfs.com





More information about the fedora-list mailing list