Find the answer to your Linux question:
Results 1 to 6 of 6
I installed g++ compiler on mandrake using urpmi command and am able to compile and create output files. g++ -o first first.cpp But I cant run this created output file. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2005
    Location
    Los Angeles
    Posts
    4

    g++ compiler


    I installed g++ compiler on mandrake using urpmi command and am able to compile and create output files.

    g++ -o first first.cpp

    But I cant run this created output file.

    I also changed the file mode to 777 and tried running it. But it says not a valid command

    Please throw some light on this,

    Thanks,
    Jaydeep

    A NEWBIE

  2. #2
    Linux Newbie
    Join Date
    Aug 2004
    Posts
    220
    1st of all i'll make the asumption that you are runing the output file from a terminal.

    2nd have you tried this?
    Code:
     chmod u+x a.out

  3. #3
    Linux Engineer
    Join Date
    Nov 2004
    Location
    home
    Posts
    796
    If the output is called 'first', are you running 'first' or './first'?

  4. #4
    Just Joined!
    Join Date
    Feb 2005
    Location
    Los Angeles
    Posts
    4
    I am running "first" and not ./first from a TERMINAL

    Also , I changed the mode using the command

    chmod -c 777 first

    Thanks
    Jaydeep

  5. #5
    Just Joined!
    Join Date
    Feb 2005
    Location
    Los Angeles
    Posts
    4
    it worked with ./first

    Whts the difference between ./first and first ...

    doesnt the command looks in the current directory unless specified ?

    Jaydeep

  6. #6
    Linux Engineer
    Join Date
    Nov 2004
    Location
    home
    Posts
    796
    Unless you have . in your path, then your current directory is not searched for executables, so you need to use ./ which means current directory. You could add . to your path to avoid this, but depending on where you put it and what you have in your current directory it may cause some minor annoyances with the program you want not being the one you run. Also, it is generally considered not good to do this for root.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •