Search code examples
c++qtlinkerundefined-symbol

Symbol lookup error problem in QT project


I am trying to add a new library to the Qt plugins folder.

That plugin is located here: http://qt.gitorious.org/qt-solutions/qt-solutions/trees/master/qtjp2imageformat

It says that it requires jasper to build, so I downloaded jasper, and built it, generating a libjasper.a in my jasper/lib folder (which is in my home dir, not in /usr or anything)

So i built out qtjp2imageformat using the jasper include files, and linking against that libjasper.a file

here are the relevant lines from the makefile:

INCPATH       = -I/usr/lib64/qt4/mkspecs/linux-g++-64 -I. -I/usr/lib64/qt4/include/QtCore -I/usr/lib64/qt4/include/QtGui -I/usr/lib64/qt4/include -I../src -I. -I/home/dcole/software/jasper-1.900.1/include
LIBS          = $(SUBLIBS)  -L/usr/lib64/qt4/lib64 -L/home/dcole/software/jasper-1.900.1/lib -ljasper -lQtGui -L/usr/lib64/mysql -L/usr/lib64/qt4/lib64 -L/usr/X11R6/lib64 -lQtCore -lpthread 

I then put the generated libqtjp2.so in the QT Plugins/imageformats folder, and now when my code runs, and gets to the part where it's going to read a jpeg2000, I get the following: symbol lookup error: /usr/lib64/qt4/plugins/imageformats/libqtjp2.so: undefined symbol: jas_init

So I think jas_init comes from jasper - how come my QT project can't see that? Do I need to also make MY project link against libjasper.a, or have I linked the library wrong when I built libqtjp2?

Thanks


Solution

  • You didn't say which distro you are using, but the simplest would be to install the jasper package and link your application to it's library.

    by the way, did you build static library (.a) or dynamic (.so)? Try building a dynamic library