Making dynamic libraries

I’m migrating from windows over to linux and I’m having trouble making dynamic libraries (along with many other things…).

I am trying:

g++ -c -fPIC -Wno-long-long -I/usr/include/root ./Vehicle/LVehicle.cpp

followed by:

ld -shared -soname -o -lc LVehicle.o

I then move this into the proper directory and link it to by:

ln -sf

When I try to load the library in root I get the following:

root [0] gSystem->Load(“libVehicle”)
dlopen error: /home/clkunz/root_work/src_dev/dlls/./ undefined sym
bol: _ZN8LVehicle11ShowMembersER16TMemberInspectorPc
Load Error: Failed to load Dynamic link library /home/clkunz/root_work/src_dev/d
*** Interpreter error recovered ***
root [1] .q

I think I’m missing something simple. Help!



[quote]dlopen error: /home/clkunz/root_work/src_dev/dlls/./ undefined sym
bol: _ZN8LVehicle11ShowMembersER16TMemberInspectorPc [/quote]
You are missing the dictionary for your class ‘Vehicle’ (i.e. you need to run rootcint, compile the result and include it in your library).

Instead of ld -shared -soname -o -lc LVehicle.o Use g++ -shared -soname -o -lc LVehicle.o This is because ld is not C++ aware will not properly setup the global object initialization.