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

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

Could anyone please tell me what that linking error means??


What was your commandline?


Very difficult to say without more info. Are you using Dev-C++ or command line? If it's command line it might be an error in you setup

g++ -c myfile.cpp -o myfile.o -s
g++ myfile.o -lalleg -o myexe.exe -s

That should do the trick (assuming you only use allegro, that is). If it's Dev-Cpp I don't know exactly what cause it. It might be an error in your setup; I don't know.


My guess would be that you're commandline arguements would imply linking, but you've specified either -c or -S so it's not allowed to link.


Your files have spaces in their names.
We will now stone you.


We will now stone you.

"Are there any women here today?"

Ehh, all right. Two points, ah, two flats, and a packet of gravel.



No spaces, +, - etc in my files...

I am using Dev-c++ 5, but this also happens with the same code in Djgpp w/ RHIDE.

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

2. ../hello/main.o: No such file or directory

I know there are not any object files. Dosent Dev-c++ generate them for you?

The error also states that the file that it is getting the error in also is named: G_~1.EXE

My program is only one file and it is: main.cpp

Me wonders if I need to reinstall...:(


Just doens't give us any useful information. Avoid giving us the commandline supplied for the compiler at all costs.
It's way funnier if we try to guess what's happening.

Try to give us some hints which lead in different directions. You could try to mention VC and linux for example. Or that you don't understand why it does generate a core file instead of an .exe or something.

On the other hand, maybe you don't want a solution? And you just use this thread to chat about the problem? Like to release steam? Now then it's ok.


Me wonders if I need to reinstall...:(

Re-install what? Windows? On the Linux partition of your iMac?

Maybe you should simply try to generate a new project in Dev-cpp and try again.

On the other hand reinstalling might be more fun. It also sounds better.

Make sure you print the docs to dev-cpp / the FAQ, etc. before you reinstall, so you have something to read during the installation process.


What version of MinGW are you using (note: MinGW, the compiler, not Dev-C++, the IDE)?

Thomas Fjellstrom

Is DevC++ installed in C:\Program Files? If so, then there IS a space in your filenames ;)

[edit] w0w. Im full of nothing today. ;)


Ooops sorry bout that spellcaster.

Heres the compile log:

Compiler: Default compiler
Building Makefile: "C:\hello\"
Executing make...
make.exe -f "C:\hello\" all
g++.exe -c main.cpp -o ../hello/main.o -I"C:/DEVCPP/include" -I"C:/DEVCPP/include/c++" -I"C:/DEVCPP/include" C:\DevCpp\lib\liballeg.a

G__~1.EXE: cannot specify -o with -c or -S and multiple compilations

g++.exe ../hello/main.o -o "hello.exe" -L"C:/DEVCPP/lib" -I"C:/DEVCPP/include" -I"C:/DEVCPP/include/c++" -I"C:/DEVCPP/include" C:\DevCpp\lib\liballeg.a

G__~1.EXE: ../hello/main.o: No such file or directory

Execution terminated

No Dev-c++ is not in Program files, its right here:

And I am using Mingw/GCC 3.2


You're specifying the allegro library in the compile call.
That won't work.

Make sure you put it in the lib section of the settings.

I don't know dev-cpp but I guess you should be able to find a link tab with a libs text entry field.

Oh: see how posting the cmd line helps?


Haha, cool now it works.
Thanks a lot spellcaster.

I was specifying the allegro library in the compile call.


Glad I could help. I'm also glad you didn't take my small rant above personally ;)

Thread #231444. Printed from