0

I just recently made the move to Linux, and now looking to program on it as well.

However, for some reason I cannot get an executable to work.

Here's what I've done:

  1. Downloaded Code::Blocks
  2. Made a new Console Project in Workspace 1 with C source.
  3. Added a getchar() before return(0);
  4. Ran and Compiled - Which works perfectly INSIDE Code::Blocks
  5. Went to the bin/release folder in which the file is saved, tried double clicking, right clicking and selecting: open, open with, tried using terminal to run the name of my program. I copied the folder URL, and then name of the file.. I just can't seem to get the created file to execute!

In windows it made a .exe, I know there is no ending (?) in linux. (Could be wrong).

I'm currently running Ubuntu 11.04.

2
  • I think that debugging this issue would be more suited to the chat rooms. There is no actual question here. Commented Sep 2, 2011 at 17:45
  • 1
    What error message do you get when you open the program from your terminal? Commented Sep 2, 2011 at 17:47

3 Answers 3

3

Most Linux distributions don't include the current directory in the PATH variable that determines where to search for executables. Try opening a terminal, changing to the bin/release directory and explicitly qualifying your executable for the current directory:

./myprogram

This is in contrast to Windows, where you can simply type "myprogram.exe".

Sign up to request clarification or add additional context in comments.

Comments

2

You might need to grant your program permission to run as an executable:

sudo chmod +x yourProgram

Comments

0

In the terminal emulator, go to (cd) the folder where the executable is created.

Type ./programname

Where programname is the name of the executable file (./ tells the shell to look in the current directory for the program to run)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.