why is "./" needed to run a c++ program?

i'm on ubuntu and i just wanna know why i need to to type the "./" before and object file to run it?

for example "g++ pop.cpp -o pop"

i need to type "./pop" to run it. why do i need to type the "./"?
anyone knows?
. is basically shorthand for the current directory path, so ./pop is /current/directory/path/pop
but why would i need the / then? actually why would i need the ./ are all if i am already in the directory where pop is?
I believe the shell first checks built in commands then directories in your PATH, unless your current directory is in your PATH it wont be checked. If you omit the / what the shell interprets is /current/directory/pathpop
It's a security measure to prevent a program with the name of a common command in the current directory to be accidentally run instead of the actual command.
Topic archived. No new replies allowed.