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!
You see, on Ubuntu, and Linux, executables have no extension (unlike Windows, which uses
.exeand.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 thecdcommand to get to that directory:Then execute the program like this:
(
helloreplaces with the file name of your program). If this doesn’t work with an error message about permissions, execute this first: