What were the exact commands that you used to compile your program and attempt to execute the binary? Also, what are the permissions on the binary that gcc created?
I guess as an example for how I would do it, if I wanted to compile my file helloWorld.c into a binary executable called hello, I would run the following command (everything after the $ sign):
Code:
[gatoazul@computadora ~]$ gcc -o hello helloWorld.c
Then instead of the a.out file, I'll have an executable named hello:
Code:
[gatoazul@computadora ~]$ ls -l
total 12
-rwxr-xr-x 1 gatoazul users 6440 Mar 26 18:54 hello
-rw-r--r-- 1 gatoazul users 91 Mar 26 18:54 helloWorld.c
The first set of permissions (the bolded letters in the -rwxr-xr-x part) on the hello file are critical when it comes to me executing the file. The next set shows what those in my group can do, and the last set shows what others can do. The rwx for me as a user shows me that I can
read,
write, and e
xecute the file. If you don't have execute permissions on your file, you can easily set it so that you do (and if you do have execute permissions, then ignore this step):
Code:
[gatoazul@computadora ~]$ chmod u+x hello
Now to execute hello, you'll prefix it with a ./
Code:
[gatoazul@computadora ~]$ ./hello
hello, world!
The ./ tells the shell to look in the current directory for the file (or folder) that follows the / and if you have execute permissions, it will execute that file. In this case, the shell executes the binary file called hello that we compiled.
I guess I'm not aware of any quick start guides to GCC, but I'm sure Google could come up with some pretty easily. You might want to take a look at the official GCC documentation -- it's quite good and very thorough:
http://gcc.gnu.org/onlinedocs/
Sorry if my quick little tutorial was either too simplistic or unclear at all...just let me know though if you don't understand something and I can fix it or explain it better.
Hope that helps!