简体   繁体   中英

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 -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 . You can use the command echo $PATH to see what your current path is.

Normally, on linux, your path will include the directory $HOME/bin if it exists. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM