Hi, I have problem with libraries in qt. When I tried build static and dynamic libraries, qtcreator displayed me some form. I don't know, how I can supplement it.
If I create some library, How can I load it to my program in qt?
Hi, I have problem with libraries in qt. When I tried build static and dynamic libraries, qtcreator displayed me some form. I don't know, how I can supplement it.
If I create some library, How can I load it to my program in qt?
The Project file for the library should be like this example:
Qt Code:
PROJECT = project TARGET = project TEMPLATE = lib VER_MAJ = 1 VER_MIN = 1 VER_PAT = 0 VERSION = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT} #CONFIG += staticlib CONFIG += dll DEBUG_SUFFIX = RELEASE_SUFFIX = DESTDIR = lib OBJECTS_DIR = build/obj MOC_DIR = build/moc HEADERS = your headers SOURCES = your sourcesTo copy to clipboard, switch view to plain text mode
The project that use this library should have this two lines:
Qt Code:
INCLUDEPATH += path where there are the headers of the library LIBS += -LPATH -lNAMETo copy to clipboard, switch view to plain text mode
Where:
PATH is the path where there is the library (.dll or .so or .a or .lib).
NAME is the name of the file without the extension
For example, if the library is locate at C:\libs\library.dll you should add this line:
Qt Code:
LIBS += -LC:\libs -llibraryTo copy to clipboard, switch view to plain text mode
Trok (17th June 2009)
When I build my library, some form display me. It have 4 text fields as: Name, Executable, Arguments and Working Director with $BUILDDIR. What it mean? How I must supplement it?
When I already load library to project like you, how can I call function to file?
Btw: I don't understand your first code ;/ Where I must put it?
So you don't use QtCreator... I think M$ Visual Studio do the same.
The Qt project has got a project.pro file with the lists of the headers, sources, configuration settings...
Yes i know that qtcreator have list in project.pro, but I don't understand last form after built. What's mean "Executable"? How supplement it? ;/
Ok. The form you're talking is in the section Project, Run settings
I don't know why Qtcreator shows you this. Maybe he can't find the executable you're compiled. It shows this also for normal project, without external library?
Trok (17th June 2009)
PaceyIV thanks for all. When I only build my library it work good. So far I compiled and run it.
It's deliver.
Bookmarks