WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: novice compiling question  (Read 2469 times)

Offline Tuftec

  • Full Member
  • ***
  • Posts: 111
novice compiling question
« 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.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11698
Re: novice compiling question
« Reply #1 on: June 05, 2011, 06:40:57 PM »
Hi Tuftec
This trips up almost everyone. Try  ./gpiotest

Offline Tuftec

  • Full Member
  • ***
  • Posts: 111
Re: novice compiling question
« Reply #2 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.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11698
Re: novice compiling question
« Reply #3 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  ./

Offline Tuftec

  • Full Member
  • ***
  • Posts: 111
Re: novice compiling question
« Reply #4 on: June 05, 2011, 06:53:43 PM »
Right.

Thanks.

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: novice compiling question
« Reply #5 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.


32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: novice compiling question
« Reply #6 on: June 05, 2011, 10:44:21 PM »
Or you could just symlink it into a dir which is in $PATH.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)