[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

socket question (beginner)



I have this feeling that I'm going to feel terribly stupid once
someone tells me what I'm doing wrong, but....

=======
#include <sys/types.h>
#include <sys/socket.h>

int main( const int argc, const char * argv[] )
{
    sockaddr_in s;
    return 0;
}
=======
Rankor:~/src/sockets$g++ stupid.cpp
stupid.cpp: In function `int main(int, const char **)':
stupid.cpp:6: `sockaddr_in' undeclared (first use this function)
stupid.cpp:6: (Each undeclared identifier is reported only once...
stupid.cpp:6: parse error before `;'
=======
-   sockaddr_in s;
+   struct sockaddr_in s;
=======
Rankor:~/src/sockets$g++ stupid.cpp
stupid.cpp: In function `int main(int, const char **)':
stupid.cpp:6: aggregate `struct sockaddr_in s' has incomplete type and cannot be initialized
=======
Rankor:~/src/sockets$g++ --version
2.95.2

What am I missing?

THANKS!

Jonathan

-- 
jjlupa@jamdata.net
GPG public key available from http://lupavista.jamdata.net/gpg.asc
------------------------------------------------------------------
Lament 1750: "If I only had a radioactive decay source and a fast 
free-running oscillator..."

Attachment: pgpOexKuxRRK4.pgp
Description: PGP signature


Reply to: