undefined reference to 'function'

i want to use one program as a shared library for an other program.

i started as follows:
i have a application which i have compiled using

/usr/bin/g++ -I/usr/include/libxml2 -fpermissive -ffriend-injection -Wformat -Wno-deprecated -Xlinker -zmuldefs -fPIC -c abc.cpp

then i have created a shared object library from the objects i get from this file using this command

g++ -fPIC -Xlinker -zmuldefs -shared -o libabc.so abc.o
after this i get the libabc.so file which i copy to the
sudo cp libabc.so /usr/local/lib/libabc.so


now when i compile my orignal application which will use this newly created library libabc.so using this command
/usr/local/lib/libabd.so: undefined reference to `xmlXPathNewContext' i get errors for all the functions i used of that included library libxml2 in the first application and the function which has this undefined reference is actually the library i include in the first program using -I/usr/include/libxml2

so kindly anyone guide me where i need corrections
You aren't linking to libxml. All I can say is that.
can you help me how should i do that :)
You should add something like a "-l libxml2" to your command line, and add your /usr/lib/libxml2 to your library folders. I don't know what's that command anyways, maybe it's -L/usr/lib/libxml2
agree with EssGeEich...
-l strips lib and .so
It should be simply -lxml2

/usr/lib/ should be already on the lib path.
/usr/lib/ should be already on the lib path.

What if the lib is in /usr/lib/libxml2/ ? (Not on Linux from some time huh)
Last edited on
Topic archived. No new replies allowed.