emitrax
15th May 2009, 15:51
Hi,
I'm using QTCreator (first time) to build a project that links to a shared library.
I've added (hopefully) the correct macros to the .pro file
INCLUDEPATH += /path/to/include/
LIBS += -L/path/to/lib -lmylib
but linking fails due to "undefined reference to" error.
I managed to solve the problem by using QTLibrary as explained at the
following link
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qlibrary.html#details
with the following example.
QLibrary myLib("mylib");
typedef void (*MyPrototype)();
MyPrototype myFunction = (MyPrototype) myLib.resolve("mysymbol");
if (myFunction)
myFunction();
Now I'd like to understand what I'm doing wrong because I'm sure can't resolve all library symbols that way.
Thanks in advance.
I'm using QTCreator (first time) to build a project that links to a shared library.
I've added (hopefully) the correct macros to the .pro file
INCLUDEPATH += /path/to/include/
LIBS += -L/path/to/lib -lmylib
but linking fails due to "undefined reference to" error.
I managed to solve the problem by using QTLibrary as explained at the
following link
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qlibrary.html#details
with the following example.
QLibrary myLib("mylib");
typedef void (*MyPrototype)();
MyPrototype myFunction = (MyPrototype) myLib.resolve("mysymbol");
if (myFunction)
myFunction();
Now I'd like to understand what I'm doing wrong because I'm sure can't resolve all library symbols that way.
Thanks in advance.