This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problem with static library linking
- From: Harish <harish at in dot niksun dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 24 Mar 2008 18:10:22 +0530
- Subject: Problem with static library linking
Hi,
I am having a problem with the static library as explained below.
There was an existing static library libpcap.a
I created a new static library with the name mylib.a , mylib.a calls a function func() in libpcap.a.
I created mylib.a using the below command
ar rcs mylib.a *.o libpcap.a
ranlib mylib.a
mylib.a has been successfully made.
But when I use mylib.a with an executable it says undefined symbol for the function func() in the file which is present in mylib.a.
I used the command "nm mylib.a | grep func" to verify that mylib.a actually contains func().
But still I am getting linking error.
In my link line libpcap.a comes before mylib.a
Could you please help.
I would be very thankful.
-Harish