Linking GUI app against a static lib in QtCreator - qt

What is the right way to build a library from source using MinGW and then reference it in the GUI application's project? I'm not familiar with gcc and makefiles, but I think there must be a utility which generates makefiles from existing source.
The library itself doesn't depend on anything except the standard C lib.
Thanks!

In the pro file write
LIBS += path/to/your/lib
This will add the reference to the static library. See the documentation.

Related

Cannot compile Qt project due to dll problems

I am trying to create a Qt program that is able to control an Amptek 8000a MCA (a device that is connected via COM port for radiation detection purposes). The manufacturer provides c++, labview and vb API, but I am having a lot of trouble with Qt (C++) to recognise the dll. I have added the library using Qt's in-built add library function but I get lots of errors undefined reference to... e.g. error: undefined reference to PmcaPowerUp#4. The relevent part of my pro file looks like:
win32: LIBS += -L$$PWD/Libraries/ -lPMCADLL
INCLUDEPATH += $$PWD/Libraries
DEPENDPATH += $$PWD/Libraries
win32:!win32-g++: PRE_TARGETDEPS += $$PWD/Libraries/PMCADLL.lib
Can I use the .dll provided in the package above?
Do I have to compile it myself with mingw/qt?
It's giving me a lot of trouble when all you have to do with Matlab is loadlibrary('PMCADLL.dll','PmcaCom.h').
Done.
How I can get my project to link to the dll correctly or use mingw to compile the dll with the source files the manufacturer provides?
If a dll you have was generate on a platform or even with a compiler that is not compatable with your own you may (and would) have problems with it. So if you have a source code the best way is to compile a dll using it. Take a look at docs.

Deployment QML app with minimum Qt libraries

I have an app wirtten with C++ (just simple QML loader) and QML (all GUI and logics).
Now I want to create some package for deployment to other systems. Currently I need it only for Windows so I create a package with Inno Setup.
I packaged my exe file and couple of Qt libraries. To view what libraries I need I used Dependency Walker. But I was surprized that my app was linked with unused libraries:
Qt5Multimedia.dll
Qt5MultimediaWidgets.dll
Qt5Sensors.dll
Qt5Positioning.dll
Also I see these libraries in compiler output: -lQt5Positioning -lQt5Sensors ... etc.
But I don't use no multimedia no sensors no positioning at all!!
In .pro file I use that:
QT += qml quick sql widgets xml webkitwidgets
So my qustion - how can I compile my app without these superfluous libraries?

Where to obtain qmake (QT) compiler for netbeans?

I would like to use netbeans 8 for make QT applications. How ever, I have to specify the qmake file, which is for compiling QT apps. Is there any official source where I can get it? I tried google a lot, but haven't found any normal place. Thanks for the help in advance.
qmake is a program that compiles Project Files (.pro) into a Makefile. Think of it as "autoconf" of Qt world. To compile a Qt project, you only need to perform 2 steps,
run qmake to generate a Makefile from the Project File (.pro)
run make to build your application
netbeans.org has a step-by-step guide how do set things up,
https://netbeans.org/kb/72/cnd/qt-applications.html
qmake is a Qt specific replacement for the make utility, not a compiler. It is part of the Qt distribution actually... Just checked here, yes, it is part of the libqt4-devel package. Note that obviously you need the Qt development packages in addition to the runtime Qt packages.

Convert project Qt to file .exe for window

Hello i'm a young develop on Qt. I want to know that can we convert project Qt (header, source, form, resource) to a file can run without Qt Creator? And how can we convert it to a file executable on window (.exe)?
The compiler is responsible for making an executable out of the source code. This has nothing to do with Qt.
When you start a program from the QtCreator an executable file is built by the compiler, then started. Have a look in your project folder to find that .exe file.
You dont have to do anything special. Each Qt project has a .pro file that is used for compiling. You need to use qmake on the command line with the .pro file as input. This will generate a makefile that you can then give to nmake.exe (if using Visual Studio compilers) or mingw-make (if you are uisng mingw compilers) to build. These steps will compile your source code into the .exe. Look through documentation of qmake to know more. Qt Creator also does the same steps and you can check out the buildlog in Qt Creator to see it working.
Yes, the exe file that you compile with Qt Creator or alternatively some other IDE or compiler is technically all you need to run the project from there on, except you need to have the linked Qt libraries somehow available to the executable. This is especially important if you plan to run it on a machine different from the one you developed it on. See the Qt documentation on Deploying Qt Applications for other details you may need to consider in that case.

compiling libspeex for symbian

I want to use libspeex library in my nokia Qt application. How do I compile speex for this purpose, and how do i add it to my qt project?
Did you check the README file for Symbian?
If you manage to compile it, basically you just need to add a line like this in your .pro file:
symbian:LIBS += c:/path/to/library/speex.lib
(or whatever the resulting library is called).

Resources