How can I run the executable file created by Code::Blocks on Ubuntu?

11,789

You see, on Ubuntu, and Linux, executables have no extension (unlike Windows, which uses .exe and .com). And there's another thing: To run a file, the executable bit must be set. So, to execute the application (I'm assuming you're using Unity), open the dash, and search for "Terminal". Start the first result. Here, you'll be in a console, where you can type commands for the system. The folder is starts in is your home directory. First, use the cd command to get to that directory:

cd Documents/Programing/HelloWorld/

Then execute the program like this:

./hello

(hello replaces with the file name of your program). If this doesn't work with an error message about permissions, execute this first:

chmod +x hello
Share:
11,789
EdgarZeng
Author by

EdgarZeng

Updated on June 05, 2022

Comments

  • EdgarZeng
    EdgarZeng almost 2 years

    I have written a small program just like hello the world, everything was OK when I run it within the Code::Blocks IDE. But I couldn't run the file created outside Code::Blocks. In it's Properties, I found its type being executable(application/x-executable).

    And another question I have is, why is the file created by Code::Blocks not of the .exe type. Of course, I don't want to run the file on Ubuntu like on Windows. And I think there is another way to compile and debug programs on Ubuntu, that's a better, hehe. Please help me! thank you!