LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   not able to include archived C library into my program (https://www.linuxquestions.org/questions/programming-9/not-able-to-include-archived-c-library-into-my-program-254624/)

gauravsahni 11-14-2004 05:05 AM

not able to include archived C library into my program
 
i have a main program in which i want to tinclude different archieves C library for example

/root/kerb/src/lib/krb5/
the above directory contains libkrb5.a archieved library (which contains around 300 object files)

/root/kerb/src/lib/krb5/lib/krb
the above directory contains libdes.a archieved library

similary there are many archived library distributed accross different directories i want ot include these libraries into my main program how to do that .
my main program is at the following path

/root/client/main.c

probaaly i have to write a make file to include the above iam not able to do that
can some body send me sample make file to include the above two libraries as an example ...
plz help because i am at the do or die situation?<>>>>>>>>>>,,,

itsme86 11-14-2004 05:11 AM

Try:

cd /root/client; gcc main.c /root/kerb/src/lib/krb5/libkrb5.a /root/kerb/src/lib/krb5/lib/krb/libdes.a

That should create a file /root/client/a.out with those 2 libraries linked statically.

gauravsahni 11-14-2004 05:40 AM

tried :the option you provided still not working
 
thanks for repling to my post but i have tried that its not working moreover there is no output file created such as a.out
i want a different executabe to be creeted with name "client" not the a,out.
what if ihave to write a make file for that because everytime i cannot provide such a long gcc command everytime morover ihave to link 8 such liberies into my project. plz help

itsme86 11-14-2004 06:28 AM

What error message do you get when you try compiling?

gauravsahni 11-15-2004 02:30 AM

undefined reference to the fucntion
 
like if there is a function krb5_get_timestamp it the library libkrb5.a then it says undefined reference to the above function moreover in the existing projects there is no such error

and no a.out file is being generated


moreover i have to generate and exe file wiht the name client and every time when i make change to library i cannot give the path for each and every library i have to write the make file can you help me in that ....???????.


All times are GMT -5. The time now is 06:46 AM.