From owner-freebsd-hackers Wed Dec 29 14: 7:50 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from virtual-voodoo.com (virtual-voodoo.com [204.120.165.254]) by hub.freebsd.org (Postfix) with ESMTP id 31F2415102 for ; Wed, 29 Dec 1999 14:07:45 -0800 (PST) (envelope-from root@virtual-voodoo.com) Received: (from root@localhost) by virtual-voodoo.com (8.9.3/8.9.3) id RAA67250 for freebsd-hackers@freebsd.org; Wed, 29 Dec 1999 17:07:53 -0500 (EST) (envelope-from root) Date: Wed, 29 Dec 1999 17:07:53 -0500 (EST) From: Charlie Root Message-Id: <199912292207.RAA67250@virtual-voodoo.com> To: freebsd-hackers@freebsd.org Subject: gcc command line ordering question Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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