home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4557 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: soap.news.pipex.net!pipex!usenet
  2. From: m.hendry@dial.pipex.com (Mathew Hendry)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: simple K&R ANSI-C examples won't compile under SAS/C
  5. Date: Fri, 1 Mar 96 06:21:44
  6. Organization: Private node.
  7. Message-ID: <19960301.444BE0.6206@ai199.du.pipex.com>
  8. References: <68771782@0humpty.tomate.tng.oche.de>
  9. NNTP-Posting-Host: ai199.du.pipex.com
  10. X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
  11.  
  12. Andreas Mixich (humpty@TOMATE.TNG.OCHE.DE) wrote:
  13. : this little example form the 'Kernighan&Ritchie' won't compile:
  14. : #include <stdio.h>
  15. : #include <clib/alib_stdio_protos.h>
  16.   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  17.  
  18. Remove this line - it is not necessary and will cause problems. Why did you
  19. include it in the first place? It is not in the original example...
  20.  
  21. : main()
  22. : {
  23. :     int c;
  24. :      while((c = GetChar()) !=EOF)
  25. :     PutChar(c);
  26. : }
  27. : Yes, *you* laugh now, but for me this is really strange.
  28. : I get an error #72 in alib_stdio_protos.h; conflict with previous declaration,
  29. : see file stdio.h.
  30. :
  31. : Now, I have read the guide on this error, but if I leave out the
  32. : alib_stdio_protos.h, this will cause the error, no Prototype for function
  33. : getchar() (or so).
  34. : Also, if I do a c = GetChar(void) (as synopsis description in sclib.guide
  35. : shows) the error still ocuures.
  36.  
  37. C function names are case sensitive - replace GetChar and PutChar with getchar
  38. and putchar and the example will compile correctly.
  39.  
  40. -- Mat.
  41.