[英]Help with C Program Executable - Linux
I just recently made the move to Linux, and now looking to program on it as well. 我最近才转向Linux,现在也希望对其进行编程。
However, for some reason I cannot get an executable to work. 但是,由于某种原因,我无法使可执行文件正常工作。
Here's what I've done: 这是我所做的:
getchar()
before return(0);
在return(0);
之前添加了getchar()
return(0);
In windows it made a .exe, I know there is no ending (?) in linux. 在Windows中,它制作了一个.exe,我知道linux中没有结尾(?)。 (Could be wrong). (可能是错误的)。
I'm currently running Ubuntu 11.04. 我当前正在运行Ubuntu 11.04。
Most Linux distributions don't include the current directory in the PATH variable that determines where to search for executables. 大多数Linux发行版都没有在PATH变量中包含当前目录,该目录确定了在哪里搜索可执行文件。 Try opening a terminal, changing to the bin/release directory and explicitly qualifying your executable for the current directory: 尝试打开终端,切换到bin / release目录,并明确限定当前目录的可执行文件:
./myprogram
This is in contrast to Windows, where you can simply type "myprogram.exe". 这与Windows相反,在Windows中,您只需键入“ myprogram.exe”即可。
您可能需要授予程序权限才能作为可执行文件运行:
sudo chmod +x yourProgram
In the terminal emulator, go to (cd) the folder where the executable is created. 在终端仿真器中,转到(cd)创建可执行文件的文件夹。
Type ./programname
键入./programname
Where programname is the name of the executable file (./ tells the shell to look in the current directory for the program to run) 其中programname是可执行文件的名称(./告诉外壳程序在当前目录中查找要运行的程序)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.