Im working on app (C++ / QT / Eclipse Helios) which allows to connect to database. On some distributions of Linux (SUSE) there is a problem with libraries. 'error while loading shared libraries: libldap-2.4.so.2: cannot open shared object file: No such file or directory' Is there a possibility to add those libs into app build? I tried adding them into .pro file
FORMS +=
linux-g++{
INCLUDEPATH += source/include
LIBS += source/libldap-2.4.so.2 \
source/libldap_r-2.4.so.2 \
source/libldif-2.4.so.2 \
but it doesn't work at all.
Any ideas?
Well, installing libs on SUSE was not an option. I resolved that problem using small bash script
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DIR/lib
./myprog
and I put missing libs in folder /lib. Only inconvenience is that you have to run app using this script, not clicking the app itself. Anyway, thanks for the response! :)
Related
I am trying to build mysql driver in QT Creator in osx, but I get
error: Cannot write file
/mkspecs/modules-inst/qt_plugin_qsqlmysql.pri: Cannot create parent
directory
Thats the pro file
TARGET = qsqlmysql
HEADERS += $$PWD/qsql_mysql_p.h
SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
INCLUDEPATH += /usr/local/mysql-5.7.12-osx10.11-x86_64/include
QMAKE_LIBDIR += /usr/local/mysql-5.7.12-osx10.11-x86_64/lib/
LIBS += -lmysql
QMAKE_USE += mysql
OTHER_FILES += mysql.json
PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
include(../qsqldriverbase.pri)
Any idea?
You're trying to install a Qt plugin, so you need write permissions to Qt's installation directory.
You'll have to build Qt yourself and keep it in the home directory you've got write access to.
Perhaps it'd be better to use Qt from MacPorts, then you'd simply need to sudo port install qt5-mysql-plugin.
I have a Qt application that needs a specific folder and some files. This folder is now located inside the project folder. Is there any way to make this folder be "generated" when I use the make command to create the Standalone version of the program.
I was thinking about changing something in my .pro file but could not figure out any solution that way.
The folder contains some .lua code that I need to make the software work properly if the user select some functionalities.
One solution that copy these resources to destination folder the binary installed via qmake. Please refer to the link enter link description here
Some answers are out-of-date but inspire enough.
Possible solution(see http://doc.qt.io/qt-5/qmake-advanced-usage.html):
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
SOURCES += main.cpp
lua_dir.target = .makedir
lua_dir.commands = test -d lua_dir || mkdir lua_dir
QMAKE_EXTRA_TARGETS += lua_dir
PRE_TARGETDEPS += .makedir
You should replace lua_dir.commands = test -d lua_dir || mkdir lua_dir with appropriate to you command, I use bash command intepreter here.
you can change DESTDIR qmake variable to compile binary file straight to specified directory.
you can use INSTALLS:
someTarget.path = $$OUT_PWD/MyFolder
someTarget.files = $$PWD/SomeDirToCopy/*
INSTALLS += someTarget
this will copy all files from ProjectDirectory/SomeDirToCopy folder to BuildDirecory/MyFolder after you run make install in build directory.
I need to use the CUPS API in Qt to detect and install printers. The problem is I can't seem to make Qt detect the cups.h header file.
So far I tried (both with <> and ""):
#include <cups/cups.h>
and
#include </usr/local/include/cups/cups.h>
In the .pro file I also tried adding:
INCLUDEPATH += /usr/local/include/cups
Each time I get "cups/cups.h: no such file or directory". So can anybody provide a minimal example or a HOWTO that shows how to include and use CUPS in a Qt application.
Thanks!
PS: I'am not sure if it's relevant, but I probably should add that I cross compiled Qt for the raspberry Pi.
Install the "libcups2-dev" libraries.
sudo apt-get install libcups2-dev
then search for the library file
find / -type f -name "*.a"
you will get the response with all .a library files with the location
find "libcups.a" file from the list.
example : /home/Desktop/cups-1.7.5/cups/libcups.a
Add the destination file path in your Qt .pro project file
LIBS += "../release/build/arm926/libcups.a"
I'm working on a Qt5/QtQuick/QML application that's supposed to use QxtGlobalShortcut for hotkey control when the application is hidden or out of focus. I've been developing it using QtCreator on Linux, and I'm not entirely familiar with Linux development so I may have missed something simple.
First off, I tried cloning the master branch of the Qxt git repo from here. But for some reason ./configure failed to create a makefile according to an error that I was getting from make and make install. I'm not very experienced in building other people's projects/libraries from source, and the output I was getting from ./configure wasn't specific enough for me to figure out what was going on..
So instead, I decided to grab libqxt-dev from (X)ubuntu's APT repo. After it finished installing I added these lines to the bottom of my QtCreator project file:
INCLUDEPATH = usr/include
CONFIG += qxt
QXT += core gui
After setting up a basic global shortcut based totally off the Qxt documentation's example. I got a few compilation errors. First of all, the Qxt seem to use:
#include <QxtGlobalShortcut>
But QtCreator couldn't find that file, so I changed it to this:
#include <qxt/QxtGui/QxtGlobalShortcut>
Now it could find the Global Shortcut class header, and QtCreator stopped grumbling at me. Unfortunately, upon compilation QtCreator shot out this error message:
/usr/include/qxt/QxtGui/qxtglobalshortcut.h:28: error: qxtglobal.h: No such file or directory
I think this is caused by a problem in my project's INCLUDE path or something, but even having tried changing my projects INCLUDE path to this:
INCLUDEPATH = usr/include
usr/include/qxt/QxtCore
usr/include/qxt/QxtGui
CONFIG += qxt
QXT += core gui
I still get the same error message that QxtGlobal.h (which is being #included in QxtGlobalShortcut.h) can't be found..
So, I'm really not sure what I've done wrong, and I'm out of ideas about how to fix this.
Hopefully someone can help me understand what step I've skipped so that I can continue coding! Thanks!
EDIT: Here's what I have for my entire Qt project .pro file:
TEMPLATE = app
QT += qml quick
SOURCES += main.cpp \
Gamepad.cpp \
Script.cpp \
System.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Default rules for deployment.
include(deployment.pri)
HEADERS += \
Gamepad.h \
Script.h \
System.h
LIBS += -L/usr/lib -lSDL2
CONFIG += qxt
QXT += core gui
Everything before LIBS was automatically generated by QtCreator for my project. I added the LIBS, CONFIG, and QXT elements as per the user instructions for SDL2 and Qxt.
This is a big problem here:
INCLUDEPATH = usr/include
1) You are using relative path from the current working directory, so not /usr/include from the root of the filesystem.
2) You are deleting everything in the INCLUDEPATH because you set rather than append with +=.
3) It is unnecessary to add that line anyway since /usr/include will be looked up by default.
4) Even if it was not, you have #include "qxtglobal.h" instead of #include <qxtglobal.h>.
I would suggest to delete that line and then it should just work.
I managed to compile successfuly programs that use OpenCV with QtCreator but i have a problem with the dlls when i try to execute my application.
This is the error i get. The wierd thing is that i don't have this dll in my system.
I tried to download it and place it in the same directory with the executable but i get the same error.
here is my .pro file
LIBS += -Lc:/Users/Libraries/OpenCV2.3/build/x86/mingw/bin/
LIBS += -lopencv_calib3d230 \
-lopencv_contrib230\
-lopencv_core230 \
-lopencv_features2d230 \
-lopencv_flann230 \
-lopencv_gpu230 \
-lopencv_highgui230 \
-lopencv_imgproc230 \
-lopencv_legacy230 \
-lopencv_ml230 \
-lopencv_objdetect230 \
-lopencv_video230
INCLUDEPATH += c:/Users/Libraries/OpenCV2.3/build/include/
SOURCES += \
main.cpp
Anyone that knows why this problem occurs?
I found what was going wrong.
I compiled opencv again and changed my .pro file to link from that folder.
Linking with the opencv-superpack package that is provided for windows caused this problem.
I hope this will help others facing the same problem.
Did you try, instead of simply putting the dll in the folder to add it to the path of your system ?
On win XP it's something like:
Configuration Panel > System > Advanced > Paths
Downloading a versioned DLL probably won't work. libstdc++-6.dll should be in the bin directory of your MinGW installation (which was probably included with QtCreator, check there).
You must distribute this dll with your app (or link with -static) or at least add its directory to PATH.