Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gcc: cannot specify -o with -c and multiple compilations

1,654 views
Skip to first unread message

A.G.

unread,
Mar 11, 1999, 3:00:00 AM3/11/99
to
Hi all:

What do I do about this compilation error? I'm trying to compile proccps
with gcc 2.8.1. and glibc2.07.pre6.

gcc -O -O4 -Wall -I/usr/X11R6/include -I/usr/X11R6/include -I/include -Dl
inux
LinuxMachineDefines -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURC
E=500L -D_BSD_SOURCE -D_SVID_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DOSMAJO
RVERSION=2 -DOSMINORVERSION=0 -c XConsole.c -o XConsole.o
gcc: cannot specify -o with -c and multiple compilations
make[1]: *** [XConsole.o] Error 1

Thanx for any input!
Arcady


Christoph Haenle

unread,
Mar 12, 1999, 3:00:00 AM3/12/99
to
-c means "compile only, do not link"

-o specifies the executable's name.

Therefore, using both options simultaneously doesn't make sense.

Try this:


gcc -O -O4 -Wall -I/usr/X11R6/include -I/usr/X11R6/include -I/include -Dl
inux
LinuxMachineDefines -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURC
E=500L -D_BSD_SOURCE -D_SVID_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DOSMAJO

RVERSION=2 -DOSMINORVERSION=0 -o XConsole.o XConsole.c


-Chris.

A.G. (anti...@usa.net) wrote:
: Hi all:

J.H.M. Dassen (Ray)

unread,
Mar 12, 1999, 3:00:00 AM3/12/99
to
A.G. <anti...@usa.net> wrote:
>What do I do about this compilation error? I'm trying to compile proccps
>with gcc 2.8.1. and glibc2.07.pre6.
^^^^^^^^^

>gcc -O -O4 -Wall -I/usr/X11R6/include -I/usr/X11R6/include -I/include -Dl
>inux
>LinuxMachineDefines

^^^^^^^^^^^^^^^^^^^

gcc 2.8.1's C preprocessor no longer predefines the 'i386' symbol which
xmkmf/imake use in the definition of LinuxMachineDefines, causing the
problem you're seeing.

In any case, I wouldn't recommend gcc 2.8.1.
On the C side, you're better of sticking with gcc 2.7.2.3, as there are
problems with gcc 2.8.1 compiled Linux 2.0 kernels. And for all languages
(in particular C++) EGCS is more recent, and decently maintained.

HTH,
Ray
--
Cyberspace, a final frontier. These are the voyages of my messages,
on a lightspeed mission to explore strange new systems and to boldly go
where no data has gone before.

Edward Vigmond

unread,
Mar 12, 1999, 3:00:00 AM3/12/99
to
Christoph Haenle wrote:
>
> -c means "compile only, do not link"
>
> -o specifies the executable's name.
>
> Therefore, using both options simultaneously doesn't make sense.

I don't know about it not making sense as I have used it before. I
sometimes compile certain programs to run on a multiprocessor machine
and a single processor. Some file need to be changed, others don't. I
use defines to compile the same file for both situations and use the the
-o flag to give them different names. For example, I might have the
following lines in my Makefile

prog: a.o b.o
cc -o prog a.o b.o

smp_prog: a_smp.o b.o
cc -o smp_prog a_smp.o b.o

a_smp.o: a.c
cc -c -o a_smp.o -DSMP a.c

a.o: a.c
cc -c a.c

I can choose to compile either version of the program.

--
Ed Vigmond
Institut de Genie Biomedical, Universite de Montreal
vigm...@igb.umontreal.ca

Gérard Milmeister

unread,
Mar 13, 1999, 3:00:00 AM3/13/99
to
On Fri, 12 Mar 99 14:36:15, Christoph Haenle <ch...@cs.vu.nl> wrote:
>-c means "compile only, do not link"
>
>-o specifies the executable's name.

-o specifies the name of the output file.

>
>Therefore, using both options simultaneously doesn't make sense.
>

>Try this:


>gcc -O -O4 -Wall -I/usr/X11R6/include -I/usr/X11R6/include -I/include -Dl
>inux

>LinuxMachineDefines -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURC
>E=500L -D_BSD_SOURCE -D_SVID_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DOSMAJO
>RVERSION=2 -DOSMINORVERSION=0 -o XConsole.o XConsole.c


--
Gérard Milmeister <ge...@bluewin.ch>
Tannenrauchstrasse 35
8038 Zürich
Switzerland
+41 1 481 52 48

David E. Fox

unread,
Mar 27, 1999, 3:00:00 AM3/27/99
to
In article <slrn7eksb...@scriabin.tannenrauch.ch>,

ge...@bluewin.ch (Gérard Milmeister) writes:
>
>>
>>Therefore, using both options simultaneously doesn't make sense.
>>
>>Try this:
>>gcc -O -O4 -Wall -I/usr/X11R6/include -I/usr/X11R6/include -I/include -Dl
>>inux
>>LinuxMachineDefines -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURC

Hmm. I've encountered this when building some X programs using
xmkmf; make. There *should* be a -D in front of that LinuxMachineDefines,
and there isn't one, and this confuses gcc into thinking that you are
trying to compile multiple things.

Editing the Makefiles afterward to include the missing -D's works, but
isn't the real problem. I think this is a bug in the scripts that
xmkmf uses. I'm running a somewhat hacked/upgraded version of Redhat
5.0.


--
------------------------------------------------------------------------
David E. Fox Tax Thanks for letting me
df...@belvdere.vip.best.com the change magnetic patterns
ro...@belvedere.sbay.org churches on your hard disk.
-----------------------------------------------------------------------

0 new messages