Thread: How to run a program

  1. #1
    Registered User
    Join Date
    Dec 2013
    Posts
    26

    How to run a program

    Hi guys,

    Feel a bit of an idiot, but I have just done the helloworld program using emacs on my mac, it seems to have compiled, but I can't seem to run it from the terminal.

    I have my helloworld.cpp source code file in there and I have compiled it as hello, which is also there, but I can't work out how to run it. I thought it was:
    ./a.out
    but no luck, I have tried
    hello

    but that doesn't work either, how do I get this to run please?

    Kind regards
    Rob

  2. #2
    Guest
    Guest
    Hello Rob, you just have to type the name of the executable itself.

    Example in terminal:
    Code:
    clang helloworld.cpp -o robsprogram
    ./robsprogram
    That should do the job. Let us know if that doesn't work for you.

  3. #3
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    Are you sure the current directory is that in which the executable is?
    Are you sure you type the name of the executable correctly?
    Also, your antivirus may be blocking the program, try disabling it for a minute and see what happens.
    Devoted my life to programming...

  4. #4
    Registered User
    Join Date
    Dec 2013
    Posts
    26
    Thanks Guest, that's the one, I feel like a bit of an idiot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 09-09-2014, 02:36 PM
  2. Replies: 2
    Last Post: 12-11-2012, 12:25 AM
  3. Replies: 1
    Last Post: 03-03-2009, 04:47 PM
  4. Replies: 5
    Last Post: 08-16-2007, 11:43 PM
  5. Replies: 18
    Last Post: 11-13-2006, 01:11 PM