PDA

View Full Version : running compiled C++ executables in Terminal




cossie
Mar 29, 2007, 03:58 AM
Morning,

I'm trying to compile and run some source code in Terminal. It compiles fine using the command

gcc -c -I /home/cossie/ode/include tutorial.cpp -o tutorial

And I've tried to run the compiled file at the following attempts:


./tutorial

-bash: ./tutorial: Permission denied



sudo ./tutorial

Password:

sudo: ./tutorial: command not found


Can anyone give me any pointers as to what I'm doing wrong? I thought ./ was the way to execute an object file in a Unix environment.

Thanks,

Cossie



Palad1
Mar 29, 2007, 04:20 AM
tutorial is missing the exec flag for the current user

chmod u+x tutorial

more info :
man chmod

cossie
Mar 29, 2007, 05:53 AM
Palad1 thanks a million! I had totally forgotten about setting the permissions!

I had been using a college account where I had a script running my compiles - which set the permissions - but I can't log into it today, eugh I'm such a muppet!

Thanks again!