Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Dec 1999 17:07:53 -0500 (EST)
From:      Charlie Root <root@virtual-voodoo.com>
To:        freebsd-hackers@freebsd.org
Subject:   gcc command line ordering question
Message-ID:  <199912292207.RAA67250@virtual-voodoo.com>

next in thread | raw e-mail | index | archive | help
I have a tiny little snippit of code here (test.c):

char ldap_init();
int main(int argc, char **argv)
{
  ldap_init();
  return 0;
}

I expect (want) a runtime error but I do expect it to compile when
linked with the openldap libraries. Here's my quandery:

vv# gcc -L/usr/local/lib -I/usr/local/include -lldap -llber test.c
/tmp/ccj67244.o: In function `main':
/tmp/ccj67244.o(.text+0x7): undefined reference to `ldap_init'

Very odd... but if I changed the ordering of the arguments:

vv# gcc -L/usr/local/lib -I/usr/local/include test.c -lldap -llber
vv#

It compiles fine. I thought gcc proccessed files in the order in which
they appeard? I further thought that the only difference between
specifying a fullname and using -l was that -l surrounding the name
with lib*.a and searched multiple directories. If thats all true why
would the ordering matter here?

-Steve


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912292207.RAA67250>