Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » cannot specify -o with -c or -S and multiple compilations

This thread is locked; no one can reply to it. rss feed Print
cannot specify -o with -c or -S and multiple compilations
Gnatinator
Member #2,330
May 2002
avatar

I am using Djgpp and Rhide and when I try to complie a program it gives me this error message:

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

Does anyone here have any idea what that means? ???

Please help me.

Bob
Free Market Evangelist
September 2000
avatar

That's because the options don't really make sense to combine. -o tells gcc to link to an executable file, but -c tells gcc to compile to object code only and not create an executable (IIRC). -S tells gcc to not link, but rather dump the generated assembly code in some file.

--
- Bob
[ -- All my signature links are 404 -- ]

23yrold3yrold
Member #1,134
March 2001
avatar

I used to get this error because my source file names had spaces in them. So "Main Code.c" would be treated as two parameters, and generate your error. "MainCode.c" is valid though. DOS is funny like that ;) Does that help?

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Gnatinator
Member #2,330
May 2002
avatar

wierd....

I tried compiling my program again a few hours later and it worked.

I did not do anything to it...

I have no idea what went wrong, but apparently it was for no reason....fixed. :-/

That was an odd experience.

Can anyone comment on this?

StevenVI
Member #562
July 2000
avatar

Yes, I can, having read far too much about gcc ;).

-o means the next parameter is the output file.
-c means to make object code from source.
-S means to make asm code from source.

You can't compile multiple input files into one output file, unless the output is an executable file. When you use '-c' or '-S' it's telling the compiler to make non-executable code. This means that the following compile line is acceptable:

gcc -c myfile.c -o myexe.o

But these ones are not:

gcc -c myfile1.c myfile2.c -o myfiles.o
gcc -S myfile1.c myfile2.c -o myfiles.s

Edit: Note that '-S' is a capital S, '-s' (with lowercase) makes the compiler not include a bunch of extra information in the output, and is for use with release builds.

-Sven

__________________________________________________
Skoobalon Software
[ Lander! v2.5 ] [ Zonic the Hog v1.1 ] [ Raid 2 v1.0 ]

Go to: