Cannot run g++ compiler on a new director

I am created a new directory to contain some c++ code I am writing. However when I run the compiler on the .cc file in that directory it returns:

******:~/c++/helloworld$ g++ helloworld.cc -std=c++17 -o hello
/usr/bin/ld: cannot open output file hello: Permission denied
collect2: error: ld returned 1 exit status

I can however use the sudo command and the compiler then works. Any ideas on how to fix this?

I’ve moved this to the https://community.ubuntu.com/c/support-help-requests category because this site isn’t designed to take tech support questions. Sorry. I’d recommend using one of the official support channels listed on the https://community.ubuntu.com/t/finding-help/712 page.