This is a discussion on Library Linking in GCC within the Coding in General forums, part of the Development/Scripting category; Ok, I know I am missing something truly elemental but I need help. First off, let me apologize for my ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Ok, I know I am missing something truly elemental but I need help. First off, let me apologize for my inexperience. I am just starting use of Linux and gcc and know enough to be dangerous.
That being said, I've created a shared object library from a series of c source files in gcc. I now have a libraray libName.so in my working directory. To make sure this library works I have a test program (testprog.c) that calls the library. When I compile that file using: gcc -o testprog.c -l Name, I get the error /usr/bin/ld: cannot find -lName. I cannot seem to copy the library to any of the library directories (get an error in Unbutu that says I can't) so I would like to have the compiler pick up the library from my working directory. How do I do that? Is there anything else I am missing or any mistakes that could be causing this? Thanks for your help! |
| Sponsored Links | ||
|
|
|
||||
|
Hi!
Well I am not pro @ C/C++ I have just started to learn for my college studies. Here is what we do in lab: After creating shared lib you need to execute command (note . after -n option): Code:
ldconfig -v -n . ![]() Code:
ln -sf libmyapp.so.0 libmyapp.so Code:
gcc -Wall -g -c mytestprog.c -o mytestprog.o Code:
gcc -g -o mytestprog mytestprog.o -L. -llibmyapp Code:
LD_LIBRARY_PATH="." ./mytestprog
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| gcc linking error | kavi | Coding in General | 9 | 09-30-2005 05:25 AM |