Adding external library to my Qt application
-
I'm having problems adding a .lib to my Qt application. Using Qt SDK 1.1.4.
I have a .lib file which I have to attach to my Qt app. So I've added following line to the .pro file:
@LIBS += -L/lib -lmycustomlib.lib@
For this I'm getting following error:
@:-1: Running command: C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/tools/checklib.exe stdc++ --elf C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/mycustomlib.lib C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/qtmain.lib
checklib: error: couldn't open file.@Ok. Now I copy my .lib to the ...armv5/usdeb. Compiling, and it seems that .lib file is found now. But still all the methods from the .lib are not found:
@:-1: Running command: C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/tools/checklib.exe stdc++ --elf C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/myapplib.lib C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/qtmain.lib
Running command: C:/QtSDK/Symbian/tools/gcce4/bin/arm-none-symbianelf-g++.exe -Wl,-Ttext,0x8000 -Wl,--no-undefined -nodefaultlibs -Wl,-shared -Wl,-Tdata,0x400000 -Wl,--default-symver '-Wl,-soname=MyAppApp1{000a0000}[eae1915e].exe' -Wl,--entry=_E32Startup -Wl,-u,_E32Startup,C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/eexe.lib -o C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/MyAppApp1.exe.sym -Wl,-Map=C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/MyAppApp1.exe.map @C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/build/myappapp1/c_98d27d3889984643/MyAppApp1_exe/armv5/udeb/MyAppApp1_udeb_objects.via --start-group C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/usrt3_1.lib --end-group C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/usrt3_1.lib C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/mycustomlib.lib C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/qtmain.lib C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/euser.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/cone.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/ws32.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/etel3rdparty.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/libstdcppv5.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/QtGui.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/QtCore.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/libpthread.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/libc.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/libm.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/libdl.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/stdnew.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/drtaeabi.dso C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/lib/dfpaeabi.dso -lsupc++ -lgcc
c:/qtsdk/symbian/tools/gcce4/bin/../lib/gcc/arm-none-symbianelf/4.4.1/../../../../arm-none-symbianelf/bin/ld.exe: warning: C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/usrt3_1.lib(ucppinit.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/build/myappapp1/c_98d27d3889984643/MyAppApp1_exe/armv5/udeb/mainwindow.o: In functionMainWindow': C:/Users/Alex/Qt_projects/MyAppApp1/mainwindow.cpp:41: undefined reference to
MyAppLib::WindowToForeground()'
...
collect2: ld returned 1 exit status@What do I do wrong? Tried that with dll, and got the same result.
-
What kind of library is it? For what platform is it compiled for? I ask this because usually the library files for the Symbian platform have .dso types.
Generally for a library to be visible from the program of yours, you need the following steps:
- put the library's header files under epoc32/include
- put the .dso files under epoc32/release/armv5/lib
- Put the dll files. Here actually there are 2 ways, depending what the library supports.
- If the library provides a .dll file then you copy it at epoc32/release/gcce/udeb (or urel)
- If the library provides a .sis file then you copy it somewhere that you know and can later on access it.
- add in the .pro file:
- in the case of dlls
@
LIBS += -lmycustomlib
symbian{
addFiles.sources = mycustomlib.dll
addFiles.path = !:\sys\bin
DEPLOYMENT += addFiles
}
@ - in the case of the .sis file (where instead of 0x00000000 you place the UUID of the .sis file):
@
LIBS += -lmycustomlib
symbian{
customrules.pkg_prerules =
";mycustomlib"
"@"$(EPOCROOT)Epoc32/InstallToDevice/mycustomlib.sisx",(0x00000000)"
" "
DEPLOYMENT += customrules
}
@5) include your headers...
-
Thanks!
The lib is compiled for Symbian. I got also dll and dso files, and I've put those according to your instructions. I can even see that my .dso file is included in the log from armv5\lib folder. But no effect so far, same "undefined reference" errors.
-
Is the library defined in a specific namespace? If that is the case, you might have forgotten the using namespace.