Hi.
I'm trying to create a program with one library and one executable that invokes that library.

At first, I've created one folder for the application, and then three subfolders, one for a test executable project, one for the library project and one that's the path in which both library and executable are copied.

APP
|
|- bin
|- MyLibrary
| |- MyLibrary <== .pro and sources
| |- MyLibrary-build-desktop
|- TestApp
| |- TestApp <== .pro and sources
| |- TestApp-build-desktop


This is the .pro of the library

Qt Code:
  1. QT -= gui
  2. TARGET = MyLibrary
  3. TEMPLATE = lib
  4. DEFINES += MYLIBRARY_LIBRARY
  5.  
  6. SOURCES += mylibrary.cpp
  7. HEADERS += mylibrary.h\
  8. MyLibrary_global.h \
  9.  
  10. # Copying to destination folder
  11. DESTDIR = ../../bin
To copy to clipboard, switch view to plain text mode 

This one is the .pro of the test application
Qt Code:
  1. QT += core
  2. QT -= gui
  3. TARGET = TestApp
  4. CONFIG += console
  5. CONFIG -= app_bundle
  6.  
  7. TEMPLATE = app
  8. SOURCES += main.cpp
  9. # MeteoGrid Library
  10. LIBS += -L../../bin/libMyLibrary.so
  11. INCLUDEPATH += ../../MyLibrary/MyLibrary
  12.  
  13.  
  14. # Copying to destination folder
  15. DESTDIR = ../../bin
To copy to clipboard, switch view to plain text mode 

When I compile the library, it's successfully copied into the bin directory.

If I include the mylibrary.h header into the test application, it finds it and it compiles.
But, if I try to use the class defined in my library

Qt Code:
  1. #include <QtCore/QCoreApplication>
  2.  
  3. #include "mylibrary.h"
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7. QCoreApplication a(argc, argv);
  8.  
  9. MyLibraryClass<qint32> xTest (1,1,1);
  10.  
  11. return a.exec();
  12. }
To copy to clipboard, switch view to plain text mode 

I obtain the error:

main.cpp.text+0x39): undefined reference to `MyLibraryClass<int>::MyLibraryClass(int, int, int)'
I'd like to know where's the error, and how can I compile successfully the executable.

Thanks in advance for your replies.