Ticket #13 (closed defect)

Opened 11 years ago

Last modified 10 years ago

Compiler Error with gcc 3.3.5: cannot specify -o with -c or

Reported by: anonymous Owned by:
Priority: normal Milestone:
Component: Version:
Keywords: Cc: bagder
Blocked By: Blocks:


Gcc stops Compilation of libssh2-0.14 with error message

"cannot specify -o with -c or -S and multiple


From the gcc manpage:

Since only one output file can be specified, it does
not make sense to use -o when compiling more than one
input file, unless you are producing an executable file
as output.

If -o is not specified, the default is to put an
executable file in a.out, the object file for
source.suffix in source.o, its assembler file in
source.s, and all preprocessed C source on standard output.


By default, the object file name for a source file is
made by replacing the suffix .c, .i, .s, etc., with .o.

so no -o flag is needed

Gcc also complains about:
/usr/include: linker input file unused because linking
not done
But that seems to be only cosmetical ...

All works fine when removing the -o <outfile>.o part
from the gcc command line when compiling without linking.

with kind regards

Harald Hellmuth <hh_at_hostserver.de>

Change History

comment:1 Changed 11 years ago by anonymous

Logged In: NO

I've been having the very same problem. How exactly can i
solve it? Where do i have to remove the "-o <outfile>.o
Thanks in advance.

comment:2 Changed 11 years ago by anonymous

Logged In: NO

Calling this in the top level directory of the untarred
sources will do the changes for you:

find . -name Makefile.in -exec \
perl -pi.bak -e 's/\$\(CC\)\s+-o\s+[\w_-]+?\.o/\$(CC)/' {} \;

with kind regards

Harald Hellmuth <hh_at_hostserver.de>

Note: See TracTickets for help on using tickets.