UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » C
  • » [Please help me ASAP] Trouble with compile in C UNX

#1 2009-10-17 01:11 PM

bocdaush
Member
Registered: 2009-10-17
Posts: 3

Re: [Please help me ASAP] Trouble with compile in C UNX

Ok. It's been resolved.Thanks

Offline

#2 2009-10-17 04:30 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,839
Website

Re: [Please help me ASAP] Trouble with compile in C UNX

Those aren't errors, they're just warnings...  It compiled fine, and if you look, I'm sure
you'll see the executable was created anyway...

The warnings are complaining about the fact that you don't cast the pointer to a
"sockaddr_in" into "(struct sockaddr *)", which is what all the socket functions really
want...  Another way around it than casting, if you're on a glibc based system (like
Linux), is to do "#define _GNU_SOURCE" at the top of your source, prior to any
#include's...  That will let glibc's magic "transparent union" stuff in the socket header
files make it so that all the socket functions will accept any sockaddr_* struct without
complaint...

But, if you add aditional warning flags to the compiler (eg: "-Wall"), you'll see it
complain about several other things you've done wrong, as well...  You should
probably look into correcting those things, as well...

Offline

#3 2009-10-18 02:18 AM

bocdaush
Member
Registered: 2009-10-17
Posts: 3

Re: [Please help me ASAP] Trouble with compile in C UNX

So, what exactly I have to modify now to run client & server ?
I'm a newbie so can you help me fix it more specifics
Is it add "#define _GNU_SOURCE" on both client & server?

Please help me to answer me soon?
I've only one day to submit it

Thanks RobSeace very much !

Offline

#4 2009-10-18 07:08 AM

bocdaush
Member
Registered: 2009-10-17
Posts: 3

Re: [Please help me ASAP] Trouble with compile in C UNX

Hi RobSeace

I've added "#define _GNU_SOURCE" in top of Client & Server classes but they still can't communicate to each other when I compile....

So,what I have to resolve this problem now....
Please help me, I must submit it soon

Thanks

Offline

#5 2009-10-18 05:51 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,839
Website

Re: [Please help me ASAP] Trouble with compile in C UNX

I don't know what your problem is now exactly...  You've removed the code, so I can't
see what problems there might be in it...  I didn't look too carefully at it before, because
I thought your only problem was the compilation warnings...

Offline

  • Index
  • » C
  • » [Please help me ASAP] Trouble with compile in C UNX

Board footer

Powered by FluxBB