Iuz,
Your problem is likely that your environment isn't set properly.
To find those settings you can type the following commands:
Code:
env
env | grep SHELL=
The command "env" Displays the current environment, and one of those items is the PATH. Here is my Slackware 14 (32 Bit) path:
Quote:
|
PATH=/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/kde4/libexec:/usr/lib/qt/bin:/usr/share/texmf/bin:.:/home/larry/bin:/usr/sbin
|
The command "env | grep SHELL=" displays what Shell is being used. Bash is default for Slackware 14.
REF:
http://en.wikipedia.org/wiki/Unix_shell
Bourne shell (sh)
Almquist shell (ash)
Bourne-Again shell (bash)
Debian Almquist shell (dash)
Korn shell (ksh)
Z shell (zsh)
C shell (csh)
TENEX C shell (tcsh)
other shells..............
The next thing to do is determine if there is a .*rc file, or a .bash_profile file.
To find the current logged in user's home shell Configuration file (*rc)... use:
Code:
man updatedb
updatedb
cd ~
locate .*rc
locate .bash_p*
One (or more) of the above files should exist.
There may be a .bash_profile file in /home/loginuser along with .bashrc. You can put configurations in either file,
and you can create either if it doesn’t exist. But, why two different files? What is the difference?
According to the bash man page, .bash_profile is executed for login shells, while .bashrc is executed for
interactive non-login shells.
If .bash_profile exists in /home/user/ with the following information already inserted:
Code:
PATH=$PATH:$HOME/bin
export PATH
just append your path modifications here instead of the .bashrc file. (ie. CentOS 6 Distro)
You need to list the *rc file to verify the contents and set the PATHS. I'm ASSUMING a Bash shell......Your may be different!
cat .bashrc -- Lists the configuration file, then you must append the proper search paths for the users shell with edit.
Quote:
export LD_LIBRARY_PATH=????????????????????????????????
export LIBRARY_PATH=???????????????????????????????????
export C_INCLUDE_PATH=?????????????????????????????????
export CPATH=??????????????????????????????????????????
|
My Debian Distro happens to be:
Quote:
export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
export LIBRARY_PATH=/usr/lib:/usr/local/lib
export C_INCLUDE_PATH=.:/usr/include:/usr/local/include
export CPATH=.:/usr/include:/usr/local/include
|
But yours may vary accordingly. You won't be able to cut & paste mine, unless your system is built exactly like mine.
It's up to you to locate exactly where all the libs, and includes are located. That is what all the previous commands
should have helped you do. Just because you have /usr/lib & /usr/local/lib included....doesn't mean your needed lib is
in that path.
That is where your detective work comes to play. SEARCH and use grep to locate the libs.
Once you have the env file set either reboot or reset the env. Once again, your system command for this
can/may be different.
This command resets the environment to what you need for Compiles, assuming the SHELL is bash. This may not be available on your system.....
REF:
http://linux.about.com/library/cmd/blcmdl1_ulimit.htm
Quote:
source filename [arguments]
Read and execute commands from filename in the current shell environment and return the exit status of the last command executed from filename. If filename does not contain a slash, file names in PATH are used to find the directory containing filename. The file searched for in PATH need not be executable. When bash is not in posix mode, the current directory is searched if no file is found in PATH. If the sourcepath option to the shopt builtin command is turned off, the PATH is not searched. If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. The return status is the status of the last command exited within the script (0 if no commands are executed), and false if filename is not found or cannot be read.
|
A quick and easy way is to append the desired directory to the PATH variable located on your .bashrc file.
Code:
echo "PATH=$PATH:/home/jacob/Dakota/bin" >> .bashrc
The command below should find several copies of stdio.h.
Code:
find /usr -iname "stdio.h"
Here is what was found on my Slackware 14 (32 Bit) Full install.
Quote:
/usr/include/stdio.h
/usr/include/isc/stdio.h
/usr/include/bits/stdio.h
/usr/include/wine/msvcrt/stdio.h
/usr/include/c++/4.7.1/tr1/stdio.h
/usr/lib/gcc/i486-slackware-linux/4.7.1/include/ssp/stdio.h
/usr/lib/bcc/include/stdio.h
/usr/src/linux-3.2.29/arch/powerpc/boot/stdio.h
bash-4.2$
|
For the test program named hello.c you just need to compile it and execute it with:
Code:
/* HELLO.C -- Hello, world */
#include <stdio.h>
main()
{
int i;
i = 0x10;
/* comment */
printf("Hello, World.....Interrupt used was %d\n",i);
}
Code:
gcc -o hello hello.c
./hello
assuming the proper file permissions are set:
Quote:
bash-4.2$ ls -alt hello*
-rwxr-xr-x 1 larry users 6084 Nov 16 03:39 hello
-rw-r--r-- 1 larry users 150 Nov 16 03:38 hello.c
bash-4.2$
|
giving the following result:
Quote:
bash-4.2$ ./hello
Hello, World.....Interrupt used was 16
bash-4.2$
|
What did you find set incorrect?
Larry