You have to include:
#include <sys/types.h>
#include <sys/socket.h>
Richard Tsujimoto
Consultant
IT Infrastructure
Canon U.S.A., Inc.
( Office: 516-328-5797
2 Fax: 516-328-4588
* Email: rtsujimoto_consultant@xxxxxxxxxxxxxx
"Lindbom, Joakim" <joakim.lindbom@xxxxxxxxxxxxx>
Sent by: c400-l-bounces+rtsujimoto_consultant=cusa.canon.com@xxxxxxxxxxxx
04/07/2009 12:24 PM
Please respond to
C programming iSeries / AS400 <c400-l@xxxxxxxxxxxx>
To
C programming iSeries / AS400 <c400-l@xxxxxxxxxxxx>
cc
Subject
Re: [C400-L] basic C question
You have forgotten the a main () clause. The compiler needs to know where
to start the program, it's not as simple as other languages where the
program starts at the first line. ;-)
Most likelly you'll wan't to return the result of you computation also.
/Joakim
________________________________________
Från: c400-l-bounces+joakim.lindbom=capgemini.com@xxxxxxxxxxxx
[c400-l-bounces+joakim.lindbom=capgemini.com@xxxxxxxxxxxx] för Lim
Hock-Chai [Lim.Hock-Chai@xxxxxxxxxxxxxxx]
Skickat: den 7 april 2009 18:15
Till: C programming iSeries / AS400
Ämne: [C400-L] basic C question
Pardon my ignorance. I just can't seems to be able to figure out why
this will not compile:
#include <string.h>
#include <unistd.h>
char hostName[256];
int hostNameLen;
hostNameLen = sizeof(hostName);
gethostname(hostName, hostNameLen);
exit(0);
Below is portion of the compiler error:
4 |
5 | char hostName[256];
6 | int hostNameLen;
7 |
8 | hostNameLen = sizeof(hostName);
===========>
.a......................................................................
..........
*=ERROR===========> a - CZM0273 Missing type in declaration of
hostNameLen.
9 |
10 | gethostname(hostName, hostNameLen);
===========>
.a......................................................................
..........
*=ERROR===========> a - CZM0273 Missing type in declaration of
gethostname.
*=SEVERE==========> a - CZM0282 The type of the parameters must be
specified in a prototype.
11 |
12 | exit(0);
===========>
.b....a.................................................................
..........
*=SEVERE==========> a - CZM0275 Unexpected text integer constant
encountered.
*=ERROR===========> b - CZM0273 Missing type in declaration of exit.
* * * * * E N D O F S O U
R C E * * * * *?
--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/c400-l.
Capgemini is a trading name used by the Capgemini Group of companies which
includes Capgemini Sverige AB, a company registered in Sweden (number
556092-3053) whose registered office is at Gustavslundsvägen 131 Box 825
- S-161 24 Bromma.
This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is
intended only for the person to whom it is addressed. If you are not the
intended recipient, you are not authorized to
read, print, retain, copy, disseminate, distribute, or use this message or
any part thereof. If you receive this message
in error, please notify the sender immediately and delete all copies of
this message.
As an Amazon Associate we earn from qualifying purchases.