Click to See Complete Forum and Search --> : why can't I access C files in my bin (PATH is set)?
'pooter
01-25-2003, 04:19 PM
I've put
export PATH=$PATH:etc
in my bashrc file, and when I type
echo $PATH
the bin shows up on the PATH. Yet when I try to use C files in the bin (source files or header files), it doesn't recognize them. What am I doing wrong?
Dun'kalis
01-25-2003, 04:31 PM
You've got to compile the C first. Its just code now.
I prefer to keep all of my source well out of the path, since it keeps things clean and organized.
'pooter
01-25-2003, 04:35 PM
nope, tried that already--compiling inside the bin, so the executable is there, and then calling it outside. It didn't recognize that either.
bwkaz
01-26-2003, 12:15 AM
#include <stdio.h>
int main()
{
printf("Hello world.\n");
return 0;
} $ gcc -o bin/hello src/hello.c
<compile messages, if any>
$ echo $PATH
<directories...>:/home/bilbo/bin
$ hello
Hello world.
$ Is that more or less what you're doing?
'pooter
01-26-2003, 06:52 PM
I am now! Thanks a bunch.
'pooter
01-26-2003, 07:19 PM
One more question: if I have calls to a bunch of functions in /src, is there an easier way to compile than listing them all out for the compiler?
bwkaz
01-26-2003, 07:40 PM
Not really... you can do a gcc -o bin/hello src/*.c or something if you need, but that will compile everything in there...
Whipping Boy
01-26-2003, 07:55 PM
You could always use "make".