programming using linux
I just compiled my first program using the CLI in linux.
i compiled it using gcc
it gave me a.out
now i thought since it was an executable, so all i needed to write was
a at the command prompt and it would execute
however it says something like
bash does not recognise the command
i also tried a.out with the same results.
what shoudl i do?
./a.out to change what the executable is called use -o when using gcc.
really you should do
then to run Of course it gets more advanced in certain senarios.
gcc -o test test.c -Wall -pedantic
Calling a program test is a really bad idea
There's an existing command of the same name, which causes some fun from time to time ;)
>> Calling a program test is a really bad idea
I can remember learning that one the "hard way" :)
what does this program "test" do,
can you guys/gals point me to resources which illustrates basic command line compiliing, execution and debugging
that really is about it. If you want to define something in your compilation then you use -D. If you want to Include another directory in compilation -I. If you want optimization(only goes up to 3 by default) the do -O3 But if you feel really smart read. Then you will feel fine.
To answer your initial question, just type in './a.out'. The './' at the start tells bash to look for the program 'a.out' in the current folder. Otherwise it will only look in your bin folders.
>what does this program "test" do
Comparisons and file type checking. You'll see it a bunch in shell scripts.
thanks for helping me out guys/gals