so shared library problem
Guys, quite newbie stuff:
I have a .so shared library with my brand new InfoBox widget placed in a MTR namespace.
Then I have a test program:
Code:
#include <QApplication>
#include <QtCore>
#include <QtGui>
int main(int argc, char* argv[]) {
MTR::InfoBox ib;
ib.show();
app.exec();
return 0;
}
its .pro:
Code:
TEMPLATE = app
CONFIG += qt
LIBS += -L/home/mtr/Programowanie/Projekty/MTRInfoBox -lMTRInfoBox
SOURCES += main.cpp
as you see I link the directory of my .so file as well as its name without "lib" prefix and .so* suffix.
I do not receive any messages that libMTRInfoBox.so.1.0.1 file hasn't been found.
Anyway I receive a message as if my test program did not know MTR::InfoBox class. Furthermore it doesn't recognize MTR namespace.
All in all I must have made some mistake somewhere...
Re: so shared library problem
The application must include a header which declares MTR::InfoBox (just like you include Qt headers which declare Qt classes).
Re: so shared library problem
I have added
Code:
#include <MTRInfoBox>
and I received:
Code:
main.cpp:4:22: error: MTRInfoBox: No such file or directory
then I tried:
Code:
#include <MTR::InfoBox>
and I received
Code:
main.cpp:4:24: error: MTR::InfoBox: No such file or directory
The libMTRInfoBox.so.1.0.1 file is placed in /home/mtr/Programowanie/Projekty/MTRInfoBox folder.
Re: so shared library problem
You should have a header file together with libMTRInfoBox.so.1.0.1.
First, you must add
Quote:
INCLUDEPATH += /home/mtr/Programowanie/Projekty/MTRInfoBox
to the .pro file to make it possible to include a header file from /home/mtr/Programowanie/Projekty/MTRInfoBox.
Then, you should use the exact name of the header file in include directive, not "MTR::InfoBox". I don't know what is the header called but let's say its name is mtrinfobox.h:
Code:
#include "mtrinfobox.h"