#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    9
    Rep Power
    0

    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 :-)

    Neil
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    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.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    55
    Rep Power
    11
    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
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    9
    Rep Power
    0
    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.

    Neil
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    9
    Rep Power
    0
    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.


    Thanks

    Neil
    Last edited by nail; August 14th, 2003 at 08:05 AM.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    9
    Rep Power
    0
    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

    :-(
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    9
    Rep Power
    0
    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.

    Neil

IMN logo majestic logo threadwatch logo seochat tools logo