gcc - Automatic library searching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to compile 'conftest.c' file but I have problems with library.

#include "confdefs.h"
char yp_get_default_domain();
int main()
{
    yp_get_default_domain();
    return 0;
}


1- If I compile with 'gcc contest -g -O2 contest.c' I get these errors:
In function `main':
undefined reference to `yp_get_default_domain'
collect2: ld returned 1 exit status

'yp_get_default_domain' function is included in both "usr/lib/libnsl.a"
static library and "/lib/libnsl.so.1" shared library; I verified the
'yp_get_default_domain' symbol presence with nm command in both libraries.
I modified my loader configuration (/etc/ld.so.conf) adding '/lib' and
'/usr/lib' searching paths so linker should have to look at my library
('libnsl.so.1' or 'libnsl.a') also in these folders, but nothing !
I tried to run gcc directly inside both '/lib' and '/usr/lib' but nothing !

2- If I compile with 'gcc contest -g -O2 -lnsl conftest.c' I have no errors
and gcc works fine.

/usr/lib/libnsl.a
/lib/libnsl.so.1

I need to not specify '-lnsl' option to permit library automatic searching
but I don't know to permit it.
What do you think ?


OS: fedora Core 2
gcc version: 4.2.1







[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux