PDA

View Full Version : GCC help


Shorty Tubbs
July 1st, 2007, 11:31 PM
whenever i try to compile a C++ script using GCC i get this.

gcc: error trying to exec 'cc1plus': execvp: No such file or director

im using feisty, and the GCC edition thats pre-loaded. Help?

Modred
July 2nd, 2007, 12:01 AM
For C++ files try using g++ instead of gcc.

Shorty Tubbs
July 2nd, 2007, 12:18 AM
Ah...genius

it will run the commands, but now theres no output

dsl
July 2nd, 2007, 03:48 PM
What is the command you are typing

If you type

g++ myprogram.cpp

then the output will be named

a.out

and you can execute it by typing

./a.out

Modred
July 2nd, 2007, 05:36 PM
On that note:

g++ -o myprogram myprogram.cpp

The "-o myprogram" tells g++ to name your output "myprogram" instead of "a.out".

Shorty Tubbs
July 2nd, 2007, 08:15 PM
dsl, that works beautifully. Modred, um, somehow i dont think im supposed to get maybe a hundred or so lines of complaints and error messages

cheers for the help

Modred
July 2nd, 2007, 08:51 PM
Modred, um, somehow i dont think im supposed to get maybe a hundred or so lines of complaints and error messages

Can't say I've ever heard of g++ going beserk because you gave it a different name for the output. o_O

You might move the "-o myprogram" to the end of the line, after typing the source file name, but that hasn't ever changed the result in my experience. And make sure that's an o, not a 0.

dsl
July 3rd, 2007, 06:01 PM
Modred's suggestion must work. "minus lowercase o" with no space in between, then a space, then the name of the executable you like (needs not be similar to the source)

nitro_n2o
July 3rd, 2007, 06:29 PM
Just a quick comment do NOT do this:

g++ myprogram.cpp -o myprogram.cpp

This might happen when click the tab or something make sure you don't do it so often :)

dsl
July 4th, 2007, 04:38 AM
You can do that just once ;-) then your source code is gone.