× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.