Operating System - HP-UX
1820882 Members
3440 Online
109628 Solutions
New Discussion юеВ

Re: syntax error in /usr/include/sys/socket.h

 
SOLVED
Go to solution
Regina Huber
New Member

syntax error in /usr/include/sys/socket.h

Hi,

FYI - I'm using gcc 3.2.3 from the HP-UX Porting and Archive Centre for HP-UX 11.0 PA-RISC on a HP-UX 11.11 machine. And I need to build a 32-bit application.

Compiling my application, I get the following errors:
/usr/include/sys/socket.h:439: syntax error before `(' token
/usr/include/sys/socket.h:441: syntax error before `(' token

There are already several postings on this error in the forum. Mostly the error shows up when building some open source appl and the solution is to use a succesful built version. I've also tried the tip to add "-I/usr/include", but it didn't work in my case.

To me it seems that there is in fact a bug in /usr/include/sys/types.h which becomes effective in socket.h?! Therefore, where can I get a fixed types.h? Or what do I have to change in types.h to get "my own one" for building my application? Or any other idea how to solve/bypass this error?

Thanks in advance for your help.
Regina
4 REPLIES 4
Michael Kelly_5
Valued Contributor

Re: syntax error in /usr/include/sys/socket.h

Regina,
IIRC gcc requires 'modified' versions of things like types.h.
These get installed somewhere in the directory structure which is created when you install gcc.
As a consequence, you need to make sure that the /usr/include/ files are searched after the gcc versions.

HTH,
Michael.
The nice thing about computers is that they do exactly what you tell them. The problem with computers is that they do EXACTLY what you tell them.
Regina Huber
New Member

Re: syntax error in /usr/include/sys/socket.h

Michael,

thanks for your reply - but can you tell me how to make sure, that the gcc include-files are used?

I was compiling with "-I -I/usr/include" plus "-nostdinc++", but then it gets totally messed up for the C++ standard includes like string, vector ... . Without "-nostdinc++" the -I settings alone didn't help.

Initially I tried to use "fixincludes" of gcc, but the gcc 3.2.3 binary package doesn't include a fixincludes skript (or even a fixinc* something file/skript).

Thanks
Regina
Steven Gillard_2
Honored Contributor
Solution

Re: syntax error in /usr/include/sys/socket.h

Not sure this is the "best" solution, but here's how I worked around this problem:

cp /usr/include/sys/socket.h /usr/local/include/sys/socket.h
vi /usr/local/include/sys/socket.h

Add the following lines near the top of the file, just after the #include's:

typedef int64_t sbsize_t; /* signed length in bytes */
typedef uint64_t bsize_t; /* unsigned length in bytes */
typedef int64_t sbsize64_t;
typedef uint64_t bsize64_t;

Gcc should look in /usr/local/include first so the modified socket.h should be picked up. If you ever install any patches that update socket.h make sure you update the new file as well!

Regards,
Steve
Regina Huber
New Member

Re: syntax error in /usr/include/sys/socket.h

Thanks a lot, Steven - this works.
(to make the solution a bit "cleaner", I guess I'll create a separate appl-specific header-file, which is included between sys/types.h and sys/socket.h)

Regina