[英]run c++ program in linux terminal with command
I have a cpp file called FileSystem.cpp, while I want to use the linux terminal and call the FileSystem executable file with command我有一个名为 FileSystem.cpp 的 cpp 文件,而我想使用 linux 终端并使用命令调用 FileSystem 可执行文件
FileSystem -i
文件系统 -i
" no matter where it located and call it without extension or './' at the front. I tried call it directly from terminal but it said: “无论它位于何处,并且不带扩展名或在前面调用'./'。我尝试直接从终端调用它,但它说:
FileSystem: command not found
When you type a command into the command line like FileSystem -i
, without an explicit path on the command (no /
characters in the first word), it looks for the exectuable in your $PATH
.当您在命令行中键入命令时,如
FileSystem -i
,命令上没有显式路径(第一个单词中没有/
字符),它会在您的$PATH
查找可执行文件。 You can use the command echo $PATH
to see what your current path is.您可以使用命令
echo $PATH
查看当前路径是什么。
Normally, on linux, your path will include the directory $HOME/bin
if it exists.通常,在 linux 上,您的路径将包含目录
$HOME/bin
如果存在)。 That's the bin
directory in your home directory, so you can put an executable you create (such as FileSystem
) in that directory and then run it as FileSystem -i
那是您的主目录中的
bin
目录,因此您可以将您创建的可执行文件(例如FileSystem
)放在该目录中,然后将其作为FileSystem -i
运行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.