Error while creating and linking libraries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pensive
    New Member
    • Apr 2008
    • 1

    #1

    Error while creating and linking libraries

    Hi!

    I was trying to create a library file for this i created two C codes, in two folders...

    and then build the file using

    gcc -fPIC -g -c -Wall d1.c
    and then
    gcc -shared -W1,-soname,lib.so.2 -o lib.so.1.0.2 d1.o -lc

    now i do

    ldconfig -n $(Path to the library)

    now when i compile the c code that uses this library by

    gcc -c -Wall d2.c -L $(LIBRARY_PATH)/lib.so.1.0.2


    This does create the d2.o file but no executable....

    can you please help me how can i get an executable (.out file) after this...

    Help would be highly appreciated...
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    You should use both the .o without -c option to create the executable


    like
    gcc d1.o d2.o -o d.exe


    Raghuram

    Comment

    Working...