August 13th, 2003, 04:23 PM
where is C includes/lib directory?
Can someone tell me where C apps on a web server look for the C/C++ includes? It is for running not compiling. I don't really know anything about C, I'm just setting 1 thing up.
For compiling is /usr/local/include the place for .h files?
The one I really want to know is for running, is it the directory /usr/local/lib/ or something? I have a file called libCcCpiTools.so which the program tries to call, can anyone please tell me where I should put it so the app can find it! (I can't just test a lot since it is on a webhost, I need to know where to ask them to put it)
Thanks for any help :-)
August 13th, 2003, 05:51 PM
Header files are only used during compilation. Library files (.so) are used during runtime and the path to the lib is either specified during compilation or is on some OS determined search path. You can often statically link your exes and not have to worry about that, at the expense of often orders of magnitude larger exes.
During compilation there is a path that the compiler looks for when searching for include files, you can also instruct the compiler (via the make file) to search in other locations.
Try building a simple app that uses the libs you are interested in to figure these things out.
August 13th, 2003, 06:55 PM
You specified a unix-like directory tree, so I will assume you are using gcc.
You could look for these directories yourself using:
find / -name 'include' -type d
find / -name 'lib' -type d
You would then specify the extra library path for the linker to look in using the -L switch, and the extra include directories to look in using the -I switch, try:
gcc -L/path/to/libCcCpiTools.so -o my_app my_source.c
August 14th, 2003, 05:38 AM
Thanks for the replys! I managed to include the files for compiling with -idirafter but I get many other compile errors which is damn annoying. I was though supplied with the precompiled file that looks for the .so file. Is there any way I can overide where it looks, or place it where it will find it.
Thanks for all your help, I really appreciate it.
August 14th, 2003, 08:02 AM
I have messed around a bit with the file to get it to compile and now I am stuck as when including the .so file, the thing keeps saying it can't find it but I'm pretty sure the path is right.
Anyway, I'll keep bashing away at it.
Last edited by nail; August 14th, 2003 at 09:05 AM.
August 14th, 2003, 10:01 AM
Ok, now I have managed to compile the thing but I am right back at the start, when I try to run my newly compiled program it gives me the error:
fatal: libCcCpiTools.so: open failed: No such file or directory
August 14th, 2003, 11:50 AM
Ok I have done it now, I used LD_LIBRARY_PATH=/pathto/libfile.so to get it to find the thing so it now runs and everything! Whether it ever gives me what I need is another question. Thanks all.