How add Boost Library to QTCreator on RPI2? - c++

I need the boost library for a project on my Raspberry Pi 2. I use QTCreator for coding but I cant add the Library. I tried to add this to the .pro file of my project in QTCreator:
LIBS += -L/usr/include/boost -lboost_chrono
I installed the boost Library using:
sudo apt-get install libboost1.55-all
If I try to compile my code I get the "boost/chrono.hpp no such file or directory".
I read somewhere that I have to compile the Library first using the same compiler as QtCreator (usually mingw) but I have no clue how to do that.(Im a beginner with the raspberry and the linux system in general)
Thx for your help

LIBS += -L
This adds a path to the linker. Your error is related to a path in the include. You should add the boost path via
INCLUDEPATH +=
As mentioned here: How to add include path in Qt Creator?

Related

z.lib problems while porting qt creator projet to windows

I am trying to port a Qt5.9 project from Mac to Windows 10.
I was able to compile the project easily in a ubuntu installation.
While trying to build it for windows, i had problems with finding zlib include headers with
#include<zlib.h>
That i corrected after following answers here on Stack to
#include<QtZlib/zlib.h>
Now i have problems in LINK phase, it can not open the file z.lib
Problem is i downloaded zlib packages, builds, source code and could not find a z.lib. Only different named libs. Searching in google i could only find people with the same problem, z.lib is not one of the libs included in zlib installation.
This is my project file:
TEMPLATE = app
QT += qml quick widgets websockets
CONFIG += c++11
SOURCES += \
main.cpp \
api.cpp \
app.cpp
HEADERS += \
api.hpp \
app.hpp
RESOURCES += qml.qrc
LIBS += -lz
I tried putting all possible dll and lib files in the project folder. None of them is named z.lib though.
The symbols for zlib are already part of the qt libraries. As long as you do not try to link the zlib explicitly it should work. At least it does work for me.
add to your project file:
!win32 {
LIBS += -lz
}
I managed to solve my problem updating my Qt installation to use MinGw 5.3 32bit. I was using VisualStudio 2015 as the compiler before.
Only changing the compiler to MinGw (g++) 5.3 made everything work with the same pro file i posted in the original question. Thanks everybody who tried to help!

How to link QCA to my Qt project?

I have successfully cloned git repository of QCA and built it using
cmake .
make
sudo make install
This created bin directory with some executables and I can confirm everything works as should by running
$ bin/qcatool-qt5 plugins
/usr/lib/x86_64-linux-gnu/qt5/plugins
/home/metheuser/qtcreator/qca/bin
Available Providers:
qca-gnupg
qca-logger
qca-ossl
This product includes cryptographic software written by Eric Young
(eay#cryptsoft.com)
qca-softstore
However when I specify in my Qt project:
QT += crypto
I get this error
Unknown module(s) in QT: crypto
I have no idea how to include the library now. I have tried adding this to my .pro file:
LIBS += -lqca
and
LIBS += -lqca2
Both resulting in error:
cannot find -lqca
What should I do? I followed the official README/INSTALL instructions.
you need to add the lib path to your .pro file. So, Instead of
LIBS += -lqca
you need
LIBS += -L$${PATH_QCA_LIB} -lqca

Crosscompiling my Linux QT Project with MXE fails. Library not found

I have a QT5 Project on Linux using taglib. It compiles fine inside QtCreator and runs flawless under Linux.
Now I want to Crosscompile the code using MXE. I've downloaded and "installed" MXE according the docs. I did a "make" for making all libraries crosscompiled. I also set my PATH as described in the docs.
the qmake run makes no errors, but when i "make" the project, the compiler complains:
./tagprocessortaglib.h:12:21: fatal error: fileref.h: No such file or directory
#include <fileref.h>
^
compilation terminated.
fileref.h is one of the library headers used by taglib, its furthermore the first of 3 includes of that lib.
In my .pro file, this two lines were added by QtCreator as i included the library for linux:
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += taglib
Are there any configurations to do for the library that I've missed? Any help is welcome! Thanks in advance!
Solved the issue:
I applied the Solution posted here: Compiling QT project for win32 target on Linux PC with larmadillo
and added the path to the library, this works for the MXR compiler run, but i have to remove it before native compiler runs.

Error compiling C++ program against GeoIP library

I'm trying to compile a simple program using the GeoIP2 lite API. I've compiled the GeoIP Lite program and it created the library files. The .la file is in /mydir/libmaxminddb-0.5.3/src
I modified my .pro file to include:
LIBS += /mydir/libmaxminddb-0.5.3 -lmaxminddb
but when I compile my project errors with "Cannot find -lmaxminddb"
Can someone tell me what's wrong? I've tried changing directories, adding a "lib" prefix to the maxminddb, and more, but I can't figure it out.
(I'm trying to link against libmaxminddb.a which is pointed to by libmaxminddb.la)
I believe in autoconf and friends the -l flags go in the LDFLAGS variabe, not LIBS.
I found elsewhere that with Qt Creator you can right click the project and add an external library. When I do so, I see the .pro file adds:
LIBS
INCLUDEPATH
DEPENDPATH
So that's what you need to add!
That should be LIBS += -L/mydir/libmaxminddb-0.5.3 -lmaxminddb. Note the extra -L in front of the directory name.

How do I link to Qwt libraries on Ubuntu?

I have installed the Qwt library on Ubuntu 10.04. The Qwt plotting widgets have appeared in QtCreator but when I try to use any of them I get the error:
"qwt_plot.h" no such file or directory.
Can anyone help?
Edit:
I've solved this by implementing Begemoth's answer as follows:
Open the project file (.pro)
Add the following lines to the bottom of the file:
INCLUDEPATH += /usr/include/qwt-qt4
LIBS += -l qwt-qt4
Ubutu like Debian provides several versions of qwt (for qt4 and qt3), so include files for qwt reside in /usr/include/qwt-qt3 or /usr/include/qwt-qt4 directory, you need to add this directory to the list of the include search path, e.g. with -I gcc flag.
PS: I assume that you have installed the development package for qwt (libqwt5-qt4-dev).