Proting C source to C++ ?

  • Thread starter =?iso-8859-1?q?Melqu=EDades?=
  • Start date
?

=?iso-8859-1?q?Melqu=EDades?=

I have an old program writed in C language,
This program simply use some general system
call like "select","read","write" etc, to
do network communication. The problem is that
when I change it to C++ fomat and use g++ 2.7.2
with g++lib 2.7.1 in SunOS 4.1.3 to compile the
program, some protype warning error occur.

How to using the old C standard library and system call
in a C++ program, how to include the protype of them?

I list some part of my program had occured error as follows:
server.C:42: aggregate `struct sockaddr_in fsin' has incomplete type and
cannot be initialized
server.C:52: warning: implicit declaration of function `int bzero(...)'
server.C:54: warning: implicit declaration of function `int getdtablesize
(...)'
server.C:56: warning: implicit declaration of function `int bcopy(...)'
server.C:57: warning: implicit declaration of function `int select(...)'
server.C:64: warning: implicit declaration of function `int accept(...)'

Thanks if anyone can solve the problem!!!!
 
V

Victor Bazarov

Melquíades said:
I have an old program writed in C language,
This program simply use some general system
call like "select","read","write" etc, to
do network communication. The problem is that
when I change it to C++ fomat and use g++ 2.7.2
with g++lib 2.7.1 in SunOS 4.1.3 to compile the
program, some protype warning error occur.

How to using the old C standard library and system call
in a C++ program, how to include the protype of them?

I list some part of my program had occured error as follows:
server.C:42: aggregate `struct sockaddr_in fsin' has incomplete type and
cannot be initialized
server.C:52: warning: implicit declaration of function `int bzero(...)'
server.C:54: warning: implicit declaration of function `int getdtablesize
(...)'
server.C:56: warning: implicit declaration of function `int bcopy(...)'
server.C:57: warning: implicit declaration of function `int select(...)'
server.C:64: warning: implicit declaration of function `int accept(...)'

Thanks if anyone can solve the problem!!!!

Nobody can solve it here, you need to post to the newsgroup for your OS.
Those functions are not standard C or C++ ones, they are most likely part
of your OS programming library. If it's so, you simply need to read about
them in your OS programming manual, and then include proper headers into
your 'server.C' file, somewhere at the top...

V
 
?

=?ISO-8859-15?Q?Juli=E1n?= Albo

Melquíades said:
How to using the old C standard library and system call
in a C++ program, how to include the protype of them?

Read the documentation of those functions in your system, here will be
described which headers you need to include.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top