I am attempting to write a http server (mainly just to learn), and I installed FreeBSD on my other box (I have Gentoo linux on my main box) to test the code to make sure its compatible with both BSD and Linux. The code compiles fine on linux, but I am getting weird compiler errors under FBSD.


all my source files compile fine except main.c:


#include <netinet/in.h>
#include <sys/types.h>
#include "lwhttpd.h"
#include "server.h"

int main(int argc, char *argv[])
{
        struct in_addr local_addr;
        uint16_t port;

        /* setup defaults */
        verbose = 1;
        local_addr.s_addr = INADDR_ANY;
        port = 0;
        nchildren = 5;

        server_init(local_addr, port);
        return 0;
}

gcc -c -g main.c produces:

In file included from main.c:1:
/usr/include/netinet/in.h:235: syntax error before `in_addr_t'
/usr/include/netinet/in.h:287: syntax error before `u_char'
In file included from /usr/include/netinet/in.h:487,
                 from main.c:1:
/usr/include/netinet6/in6.h:122: syntax error before `u_int8_t'
/usr/include/netinet6/in6.h:144: syntax error before `u_int8_t'
/usr/include/netinet6/in6.h:149: syntax error before `u_int32_t'
/usr/include/netinet6/in6.h:608: syntax error before `struct'
/usr/include/netinet6/in6.h:610: syntax error before `__P'
/usr/include/netinet6/in6.h:611: syntax error before `__P'
/usr/include/netinet6/in6.h:612: syntax error before `__P'
/usr/include/netinet6/in6.h:614: syntax error before `*'
/usr/include/netinet6/in6.h:615: syntax error before `__P'
/usr/include/netinet6/in6.h:616: syntax error before `__P'
/usr/include/netinet6/in6.h:618: syntax error before `inet6_rthdr_space'
/usr/include/netinet6/in6.h:619: syntax error before `__P'
/usr/include/netinet6/in6.h:620: syntax error before `__P'
/usr/include/netinet6/in6.h:622: syntax error before `__P'
/usr/include/netinet6/in6.h:626: syntax error before `__P'
/usr/include/netinet6/in6.h:627: syntax error before `__P'
/usr/include/netinet6/in6.h:628: syntax error before `__P'
/usr/include/netinet6/in6.h:630: syntax error before `__P'
/usr/include/netinet6/in6.h:631: syntax error before `__P'
/usr/include/netinet6/in6.h:633: syntax error before `__P'
/usr/include/netinet6/in6.h:634: syntax error before `__P'
/usr/include/netinet6/in6.h:636: syntax error before `__P'
/usr/include/netinet6/in6.h:638: syntax error before `__P'
/usr/include/netinet6/in6.h:640: syntax error before `__P'
/usr/include/netinet6/in6.h:641: syntax error before `inet6_rth_space'
/usr/include/netinet6/in6.h:642: syntax error before `__P'
/usr/include/netinet6/in6.h:643: syntax error before `__P'
/usr/include/netinet6/in6.h:644: syntax error before `__P'
/usr/include/netinet6/in6.h:645: syntax error before `__P'
/usr/include/netinet6/in6.h:646: syntax error before `__P'
In file included from /usr/include/sys/inttypes.h:9,
                 from /usr/include/sys/types.h:48,
                 from main.c:2:
/usr/include/machine/ansi.h:118: syntax error before `typedef'
main.c: In function `main':
main.c:15: structure has no member named `s_addr'

Any ideas why I am getting these errors?

Obviously something with the headers, but why?

I especially don't understand why s_addr would not be a memer of struct in_addr, because isn't that specified my POSIX?

Sorry for the long post and thanks.

Aaron

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to