Advertisement

#include hassles in sockets program

Started by November 18, 2003 06:55 PM
1 comment, last by Palidine 20 years, 10 months ago
ok, so i'm working on porting over my sockets code so it can run on *nix (specifically on freeBSD in this particular case as that is the machine i have to work with). I'm getting compiler vomits on my #include <sys/sockets.h>, and i think I just need to include something prior to it. anyway the relevant code is:

#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
  
and the errors are:

g++ -c -I/usr/local/mysql/include network/N_Msg.cpp
In file included from network/N_Msg.h:51,
                 from network/N_Msg.cpp:1:
/usr/include/sys/socket.h:52: syntax error before `;'
/usr/include/sys/socket.h:163: syntax error before `;'
/usr/include/sys/socket.h:174: syntax error before `;'
/usr/include/sys/socket.h:188: syntax error before `;'
/usr/include/sys/socket.h:190: `int64_t' was not declared in this scope
/usr/include/sys/socket.h:190: `u_char' was not declared in this scope
/usr/include/sys/socket.h:190: `sa_family_t' was not declared in this scope
/usr/include/sys/socket.h:190: size of array `__ss_pad1' is negative
/usr/include/sys/socket.h:191: syntax error before `;'
/usr/include/sys/socket.h:192: `u_char' was not declared in this scope
/usr/include/sys/socket.h:192: `sa_family_t' was not declared in this scope
/usr/include/sys/socket.h:192: `int64_t' was not declared in this scope
/usr/include/sys/socket.h:192: `u_char' was not declared in this scope
/usr/include/sys/socket.h:192: `sa_family_t' was not declared in this scope
/usr/include/sys/socket.h:192: `int64_t' was not declared in this scope
/usr/include/sys/socket.h:359: syntax error before `;'
/usr/include/sys/socket.h:364: syntax error before `['
/usr/include/sys/socket.h:399: syntax error before `;'
/usr/include/sys/socket.h:407: syntax error before `;'
/usr/include/sys/socket.h:411: syntax error before `;'
/usr/include/sys/socket.h:444: syntax error before `('
/usr/include/sys/socket.h:451: type specifier omitted for parameter
/usr/include/sys/socket.h:451: syntax error before `*'
fyi the first line it's throwing up on is (line :52): typedef u_char sa_family_t; any ideas what else i need to be including? #including stdlib.h doesn't help. [EDIT: incedentally i'm compiling with g++ (gcc version 2.95.4 20020320 [FreeBSD]] -me [edited by - Palidine on November 18, 2003 8:02:23 PM]
Perhaps you need sys/types.h?
I like the DARK layout!
Advertisement
that was it.

thanks

-me

This topic is closed to new replies.

Advertisement