How to use CTelephony API with Qt Symbian - qt

I want to use CTelephony API in Qt Symbian project but after including etel3rdparty.h and etel3rdparty.lib as library and header in .pro file like this:
LIBS += C:/NokiaQtSDK/Symbian/SDK/epoc32/release/armv5/lib/etel3rdparty.lib
INCLUDEPATH += C:/NokiaQtSDK/Symbian/SDK/epoc32/include
I am getting a lot of compilation errors.
Please share if someone faced and find the solution of this problem.

You are not supposed to include each library with the complete path in the .pro file. You need only the name of the lib, without the extension, prefixed with -l, i.e. in your case
LIBS += -letel3rdparty
Also, you would normally not need to add epoc32\include to the include path, as it's added by default.

Related

How can I tell Qt where it should look for openssl?

Qt seems to load openssl dynamically at runtime, as seen in this question.
And apparently, it gets the system openssl. For instance, on macOS, I would rather use the homebrew-installed openssl, and package it into my dmg, so that the users don't need to install it themselves.
How can I tell Qt where to look for the libraries it links? Is there something to do with the qt.conf file?
you can do something like that in your .pro file:
win32-msvc* {
LIBS += -LC:/openssl/lib/ -llibeay32
LIBS += -LC:/openssl/lib/ -lssleay32
INCLUDEPATH += C:/openssl/include
}
left click on your project -> add library -> external library -> choose the .lib file and the include folder for the library. check for which platform it is.
It will put the specific platform dependend commands to your project .pro filefile.

The right way to use a custom library in Qt?

I have a custom library to be included in Qt. Currently, it is included by adding the followings in .pro file.
INCLUDEPATH += ...
DEPENDPATH += ...
LIB += ...
Since the library is used in most of my projects. I am wondering that if there is some way to make my custom library to be INTEGRATED with the QtSDK? Maybe it can be included by syntax like the build-in components
QT += my_custom_library
and everything (header file include path, lib file include, etc...) will be done.
Is the integration possible?
You are probably looking for to create a mkspec file which then used with CONFIG option. So create a file to $QT_HOME/mkspec/features/mycoollib.prf that contains your instructions. There should be plenty of examples in that directory. The name of the file declares it's usage, so the file mycoollib.prf would be used like:
CONFIG += mycoollib

Problem with linking

I made a custom library and i compiled it into a dll (qustom.dll).
Now i want to compile another project using this dll.
What i did is to import the header files in the project and add this line in my .pro file
LIBS += -lqustom
but i get "error: cannot find -lqustom"
also i tried
LIBS += qustom.dll
and
LIBS += -libqustom.a
qustom.dll is in the project directory
Also i tried
OTHER_FILES += \
qextserialport1.dll
but didn't work either
Am i missing something here?
Missing a path perhaps? -L/path/to/dlls -ldllname
Qt plays nicely with CMake. I use that and I never get dependency/path headaches like this any more.

How to include a .lib file dynamically?

I've got a problem with my project. I am developing it on Qt Creator, and I need to add a .lib file to my project. So, I wrote this line in my .pro :
LIBS += "C:\My_Path\My_Project\lib\file.lib"
This is working fine. My only issue is that I need to write the entire path to the .lib file. Since it's a group project, it needs to be compilable on other computers without changing the path to this file every times.
I tried many syntaxes, like :
LIBS += -L"lib/" -l"file.lib"
or
LIBS += "lib\file.lib"
or
LIBS += "file.lib"
(putting the .lib file at the root and adding it to the project in Qt Creator)
None of them works :/
I also tried to add the .lib file in a QResource file but a syntax like this one :
LIBS += ":/lib/file.lib"
in a .pro file doesn't seem to work...
I am now running out of ideas :(
Help please :)
Did you try
LIBS += -Llib -lfile
or
LIBS += -L./lib -lfile?
Remember if you aren't using the full path, you don't add .lib to the library name and you don't use quotes. If the path has spaces (or you just want to be safe), use $$quote(-L<path name>)
As stated here the Unix style paths work on Windows as well where you normally need to provide the full path. qmake will fill it in for you.
I converted
LIBS += ../../lib/phraseBox.lib
to
LIBS += $$quote(-L../../lib) -lphraseBox
and
LIBS += $$quote(-L../../lib) phraseBox.lib
In one of my project with no problem on Windows. You might want to post your project files somewhere, or post the actual error messages to narrow this down.
Ok, I found the solution :
the lib/ directory has to be placed in the same directory that the Makefile (the real one, not the .pro).
Since I copied the lib/ directory in the build-desktop/ directory, everything is working fine using relative paths :)
From your tries I guess you want to link to the library using relative path which should work just fine by default.
Try this:
LIBS += -L$$relative/directory/path -llibname
If it does not work, then you might want to try setting multiple INCLUDEPATH. :/

How can I add the QtSql library in Qt creator?

when I compile the codes which has database connection, there's an error like,
QtSql: No such file or directory
I suppose that the sql library must be in Qt, but I dont have any idea why an error occured ?
what to do for enable the database's libraries?
Can you help me please, thanks
From QtSql documentation,
In your .pro file you have to add,
QT += sql
AFAIK there is no separate library to be included for SQL module. It's enough if you add the above line to your .pro file.
Since you are not aware of adding libraries,
From qmake documentation, libraries can be added by using LIBS keyword.
An example from the same documentation itself..
unix:LIBS += -lmath -L/usr/local/lib
win32:LIBS += c:\mylibs\math.lib

Resources