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:
- Downloaded Code::Blocks
- Made a new Console Project in Workspace 1 with C source.
- Added a
getchar()beforereturn(0); - Ran and Compiled – Which works perfectly INSIDE Code::Blocks
- 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.
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:
This is in contrast to Windows, where you can simply type “myprogram.exe”.