home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / c / 16070 < prev    next >
Encoding:
Text File  |  1992-11-07  |  1.9 KB  |  74 lines

  1. Path: sparky!uunet!europa.asd.contel.com!emory!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!news.netmbx.de!Germany.EU.net!mcsun!news.funet.fi!uta!kielo!av
  2. From: av@kielo.uta.fi (Arto V. Viitanen)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: gcc and cc!
  5. Message-ID: <AV.92Nov6101240@kielo.uta.fi>
  6. Date: 6 Nov 92 08:12:40 GMT
  7. References: <1dctt2INNkbi@function.mps.ohio-state.edu>
  8. Sender: news@uta.fi
  9. Reply-To: av@uta.fi (Arto V. Viitanen)
  10. Distribution: world
  11. Organization: University of Tampere, Finland
  12. Lines: 58
  13. Nntp-Posting-Host: kielo
  14. In-reply-to: ren@function.mps.ohio-state.edu's message of 6 Nov 92 04:56:02 GMT
  15.  
  16. >>>>> On 6 Nov 92 04:56:02 GMT, ren@function.mps.ohio-state.edu (Liming Ren) said:
  17. Ren> NNTP-Posting-Host: function.mps.ohio-state.edu
  18.  
  19. Ren> It seems to me that if we have two object file , say foo.o and bar.o,
  20. Ren> one is compiled with gcc and the other with cc, then we can't link them
  21. Ren> together such as
  22.  
  23. Ren> cc foo.o bar.o -o name
  24.  
  25. Ren> or
  26.  
  27. Ren> gcc foo.o bar.o -o name
  28.  
  29. On what machine, with what operating system, with what cc-compiler, with what
  30. gcc ???
  31.  
  32. I tried on SUN Sparc, with SUNoS 4.1.2, using os's compiler and gcc 2.3.1.
  33. Gcc is configured using default linker, code generation and so on.
  34.  
  35. I used following programs:
  36.  
  37. ----------------------------------------------------------------------
  38.  /* koe1.c */
  39. #include "koe2.h"
  40. main() {
  41.     koe2();
  42. }
  43.  
  44. ----------------------------------------------------------------------
  45. /* koe2.h */
  46.  
  47. koe2.h
  48. extern koe2();
  49.  
  50. ----------------------------------------------------------------------
  51. /* koe2.c */
  52. #include <stdio.h>
  53. #include "koe2.h"
  54. koe2() {
  55.    printf("hello world\n");
  56. }
  57.  
  58. ('Koe' stands for 'test' in finnish)
  59.  
  60. I compiled:
  61.  
  62. $ cc -c koe1.c
  63. $ gcc -c koe2.c
  64. $ cc -o koe koe1.o koe2.o
  65. $ ./koe
  66. hello world
  67. $ gcc -o koe koe1.o koe2.o
  68. $ ./koe
  69. hello world
  70. --
  71. Arto V. Viitanen                               email: av@uta.fi
  72. University Of Tampere,                                  av@cs.uta.fi
  73. Finland
  74.