Find the answer to your Linux question:
Results 1 to 7 of 7
i know this is a really basic and somewhat embarrising question but, how do you execute a g++ aplacition after you compile it? and does g++ automatically link the file ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User zacam87's Avatar
    Join Date
    Dec 2004
    Location
    Viriginia
    Posts
    284

    executing g++ apps


    i know this is a really basic and somewhat embarrising question but, how do you execute a g++ aplacition after you compile it? and does g++ automatically link the file while it compiles the source code or do you need to link it manually? thanks

    -zac

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    if you just compile it:
    Code:
    g++ project.cpp
    then the executable will be a.out
    if you want to make an executable called project:
    Code:
    g++ project.cpp -o project
    and gcc/g++ by default assembles and links
    -lakerdonald

  3. #3
    Linux User zacam87's Avatar
    Join Date
    Dec 2004
    Location
    Viriginia
    Posts
    284
    i understand the compiling part, and thanks for the linking info. but once i get an excutable file such as a.out or whatever other file name there is, how do i run it? is there like a "run" command or something that i dont know about?

  4. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    once you're in the same directory it is:
    Code:
    ./a.out
    or
    Code:
    ./program
    or you can give the path name:
    Code:
    /home/foo/bar/a.out
    -lakerdonald

  5. #5
    Linux User zacam87's Avatar
    Join Date
    Dec 2004
    Location
    Viriginia
    Posts
    284
    thank you {8^)

  6. #6
    Linux User zacam87's Avatar
    Join Date
    Dec 2004
    Location
    Viriginia
    Posts
    284
    thank you {8^)

  7. #7
    Linux User zacam87's Avatar
    Join Date
    Dec 2004
    Location
    Viriginia
    Posts
    284
    thank you {8^)

Posting Permissions

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