Every time I try to execute a program, no matter what program, I get this message:
bash: ./filename.cpp: Permission denied
When I compile I have no problems, it works fine. But when I want to execute I get this message.
Does it have anything to do with permissions? Because I'm having a lot of problems with this, too. I can't access my shared folders, unless I use
sudo nautilus
Please see my other question.
g++ -o yourprog main.c
then./yourprog
- do not add the-c
flag to theg++
command unless you want it to produce an object code file instead of a full executable. See What is a command to compile and run C++ programs?main.cpp
file does not actually contain amain
function: see Linker returns “relocation has an invalid symbol at symbol index…”