home *** CD-ROM | disk | FTP | other *** search
- 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
- From: av@kielo.uta.fi (Arto V. Viitanen)
- Newsgroups: comp.lang.c
- Subject: Re: gcc and cc!
- Message-ID: <AV.92Nov6101240@kielo.uta.fi>
- Date: 6 Nov 92 08:12:40 GMT
- References: <1dctt2INNkbi@function.mps.ohio-state.edu>
- Sender: news@uta.fi
- Reply-To: av@uta.fi (Arto V. Viitanen)
- Distribution: world
- Organization: University of Tampere, Finland
- Lines: 58
- Nntp-Posting-Host: kielo
- In-reply-to: ren@function.mps.ohio-state.edu's message of 6 Nov 92 04:56:02 GMT
-
- >>>>> On 6 Nov 92 04:56:02 GMT, ren@function.mps.ohio-state.edu (Liming Ren) said:
- Ren> NNTP-Posting-Host: function.mps.ohio-state.edu
-
- Ren> It seems to me that if we have two object file , say foo.o and bar.o,
- Ren> one is compiled with gcc and the other with cc, then we can't link them
- Ren> together such as
-
- Ren> cc foo.o bar.o -o name
-
- Ren> or
-
- Ren> gcc foo.o bar.o -o name
-
- On what machine, with what operating system, with what cc-compiler, with what
- gcc ???
-
- I tried on SUN Sparc, with SUNoS 4.1.2, using os's compiler and gcc 2.3.1.
- Gcc is configured using default linker, code generation and so on.
-
- I used following programs:
-
- ----------------------------------------------------------------------
- /* koe1.c */
- #include "koe2.h"
- main() {
- koe2();
- }
-
- ----------------------------------------------------------------------
- /* koe2.h */
-
- koe2.h
- extern koe2();
-
- ----------------------------------------------------------------------
- /* koe2.c */
- #include <stdio.h>
- #include "koe2.h"
- koe2() {
- printf("hello world\n");
- }
-
- ('Koe' stands for 'test' in finnish)
-
- I compiled:
-
- $ cc -c koe1.c
- $ gcc -c koe2.c
- $ cc -o koe koe1.o koe2.o
- $ ./koe
- hello world
- $ gcc -o koe koe1.o koe2.o
- $ ./koe
- hello world
- --
- Arto V. Viitanen email: av@uta.fi
- University Of Tampere, av@cs.uta.fi
- Finland
-