makes successfully (only warnings) but can't run

This is a discussion on makes successfully (only warnings) but can't run within the C++ Programming forums, part of the General Programming Boards category; Hi, When I try to run my program from the command line (with the path set to the folder with ...

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    8

    makes successfully (only warnings) but can't run

    Hi,
    When I try to run my program from the command line (with the path set to the folder with the executable), it say "No command found". I can't think why it would do this if it was made successfully (at least it seems like it was made successfully).

    Any help would be great!

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    242
    I'm just guessing that you're trying to run your program in Linux. If so, the executable doesn't turn into a command. If you named your executable foo, for example, then you'd type "./foo" at command prompt (without the quotes).

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    31
    Aisthesis's solution should work for you. As a bit of background, if you are running Linux, typing an executable's name at command line attempts to invoke a file found in /bin. In order to tell the terminal that you mean an executable in another directory, you would have to type out the path. Using ./ is a shortcut for saying "the present directory".

    If you are running DOS, the issue might be that the file doesn't have an *.exe extension.

    A further alternative explanation could be that you haven't finished compilation yet (maybe you still have *.o object files).

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,604
    If you are running DOS...? Seriously, who uses DOS these days?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    a guy with long hair Xupicor's Avatar
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    103
    frog probably had Windows console (cmd.exe) in mind, not actual DOS.
    joey2264 - can you just "cd" to the directory where the executable should be? Can you ls/dir this directory? Is the executable there?

    If not, are you sure it will be build to that directory? Depending on your IDE and project settings it can be somewhere else. Can you check the makefile?

    Also, don't treat warnings to lightly, ideally your program should compile without any.

  6. #6
    Registered User
    Join Date
    Sep 2010
    Posts
    8
    Yea, it was the stupid problem of not using "./" before the program name. Thanks for all the help guys

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. calculating the mode
    By bigggame in forum C Programming
    Replies: 10
    Last Post: 06-13-2006, 03:04 AM
  2. How I can Run exe file in C++
    By palang in forum C++ Programming
    Replies: 2
    Last Post: 05-10-2006, 11:55 AM
  3. MSVC: run w/o debugger vs run w/ debuger
    By skorman00 in forum C++ Programming
    Replies: 2
    Last Post: 01-24-2006, 08:49 PM
  4. Trying to make rand different per program run
    By Dreamerv3 in forum C++ Programming
    Replies: 6
    Last Post: 01-18-2002, 02:26 AM
  5. DJGPP violations...
    By kooma in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 01-08-2002, 11:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21