如何在Ubuntu上运行Code :: Blocks创建的可执行文件?

Edg*_*eng 1 c++ terminal command-line codeblocks ubuntu-12.04

我已经编写了一个小程序,就像hello the world,当我在Code :: Blocks IDE中运行该程序时一切正常。但是我无法运行在Code :: Blocks外部创建的文件。在其中Properties,我发现它的类型为executable(application/x-executable)

我还有一个问题是,为什么Code :: Blocks创建的文件不是这种.exe类型。当然,我不想像Windows一样在Ubuntu上运行文件。我认为还有另一种在Ubuntu上编译和调试程序的方法,呵呵。请帮我!谢谢!

Lin*_*ios 5

您会发现,在Ubuntu和Linux上,可执行文件没有扩展名(与Windows相比,后者使用.exe.com)。还有另一件事:要运行文件,必须将可执行位设置为1。因此,要执行该应用程序(假设您正在使用Unity),请打开破折号,然后搜索“ Terminal”。开始第一个结果。在这里,您将在控制台中,可以在其中键入系统命令。该文件夹开始于您的主目录。首先,使用cd命令进入该目录:

cd Documents/Programing/HelloWorld/
Run Code Online (Sandbox Code Playgroud)

然后执行如下程序:

./hello
Run Code Online (Sandbox Code Playgroud)

hello替换为程序的文件名)。如果这不能解决关于权限的错误消息,请首先执行以下操作:

chmod +x hello
Run Code Online (Sandbox Code Playgroud)