Tiny Core Linux

General TC => General TC Talk => Topic started by: Tuftec on June 05, 2011, 06:30:49 PM

Title: novice compiling question
Post by: Tuftec on June 05, 2011, 06:30:49 PM
Hi All,

I have not written any C code in over 25 years and I am now trying to get back into it.
I have written a small program using geany and I do not seem to get it to run.

My program is very simple. It just accesses a couple of ports on a custom computer board.
It is named gpiotest.

After finding all the library support/include files (I believe so anyway), I have managed to get my program to compile without errors. It appears to link ok and produce an executable that has x permissions set.

When I try to run it (by just typing it's name within the Terminal) it gives an error like this
sh: gpiotest: not found

What have I done wrong? What am I missing? Maybe some sort of link option problem under geany?
Not sure.

Help required please.

Peter.
Title: Re: novice compiling question
Post by: Rich on June 05, 2011, 06:40:57 PM
Hi Tuftec
This trips up almost everyone. Try  ./gpiotest
Title: Re: novice compiling question
Post by: Tuftec on June 05, 2011, 06:47:11 PM
Thanks Rich. That works.

Things have changed from Unix Version 7.
 ;D ;D ;D

Whay can I not just type the name?

Peter.
Title: Re: novice compiling question
Post by: Rich on June 05, 2011, 06:50:32 PM
Hi Tuftec
It's a Linux thing. Unlike DOS, the fact that it's in the current directory is not enough, it has to be in the
path, or in this case you specified the path as the current directory using  ./
Title: Re: novice compiling question
Post by: Tuftec on June 05, 2011, 06:53:43 PM
Right.

Thanks.
Title: Re: novice compiling question
Post by: Lee on June 05, 2011, 07:19:57 PM
You can always add the current directory  ( . ) to your PATH, but I seem to recall that's considered bad form in some circles for some security-related reason that was never quire clear to me.


Title: Re: novice compiling question
Post by: tinypoodle on June 05, 2011, 10:44:21 PM
Or you could just symlink it into a dir which is in $PATH.