On Tue, Dec 12, 2000 at 10:32:22AM +1100, Nick Croft wrote:

>       gcc etc etc ..      
>         -c -o rules.o rules.c
>       gcc: cannot specify -o with -c or -S and multiple compilations

You've left out an important part of the gcc command line.  You show
only a single source and object filename, but really you have more than
one, e.g.:

[johnc@dropbear ~/tmp]$ gcc -c file1.c -o file1.o -c file2.c -o file2.o
gcc: cannot specify -o with -c or -S and multiple compilations
[johnc@dropbear ~/tmp]$ gcc -v
Reading specs from /opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)

What you're trying to do is to compile more than one file in a single
command (which is OK on its own), but also specify the output
filename(s) for one or more of the compilations.  You can't do both.
Older versions of gcc used to silently fail to compile some of the
source files when you did this.

The solution is to either remove the object filenames from the command,
or split the compilations into separate commands, e.g:

[johnc@dropbear ~/tmp]$ rm *.o
[johnc@dropbear ~/tmp]$ gcc -c file1.c file2.c
[johnc@dropbear ~/tmp]$ ls -l *.o
-rw-rw-r--   1 johnc    johnc        1128 Dec 12 10:46 file1.o
-rw-rw-r--   1 johnc    johnc        1116 Dec 12 10:46 file2.o


Cheers,

John
-- 
whois [EMAIL PROTECTED]


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to