Install and use QWT under Mac OS X - qt

I am currently trying to get QWT 6.1.0 running under MAC OS X 10.7.5.
I followed the instructions over here --> http://qwt.sourceforge.net/qwtinstall.html
I didn't changed something inside the configuration files.
So everything worked fine, but now I want to use the qwt-libary inside my own Project.
I added the following line to my .pro
INCLUDEPATH += /Users/userX/Downloads/qwt-6.1.0/src
So my Project is now able to find all the header Files.
But I also have to link against the libary. But I dont know how to do so.
I tried using something like this:
LIBS += -L /usr/local/qwt-6.1.0/lib -lqwt
But than I get an error called "libary not found for -lqwt".
What I am doing wrong?
How can I link against the library or how could I import the qwt framework into my project?

I found a solution.
Here is a step by step guide on how to install QWT 6.1.0 under Mac OS X and get it running inside the QT-Creator :
Download the .tar.bz2 from here http://sourceforge.net/projects/qwt/files/qwt/6.1.0/
Extract it where you want, for Example inside your Download-Folder
Then change into the directory qwt-6.1.0
Then you have to locate the qmake command line tool ( you can do so by simply searchng for it inside the Finder.
Then qmake the qwt.pro File like /Applications/QT/5.1.0/clang_64/bin/qmake qwt.pro
make
sudo make install
Inside your QT Project you have to add the following line to the
.pro File include ( /usr/local/qwt-6.1.0/features/qwt.prf )
includes QWT libary into Project
Now you have to create a softlink like this : sudo ln -s
/usr/local/qwt-6.1.0/lib/qwt.framework/qwt /usr/lib/qwt
Thats it. QWT now should work.
UNDER MAVERICKS:
If you are using Mavericks you have to manually copy the qwt.framework to Libary/Frameworks folder for not getting the "dyld: Library not loaded: libqwt.6.dylib" error .. i dont know why but it works.

Download the .tar.bz2 from here
Extract it where you want, for Example inside your Download-Folder
Then change into the directory qwt-6.1.4 (Example: mac:~ Apple$ cd downloads/qwt-6.1.4)
Then qmake the qwt.pro (Example: mac:~ Apple$ /Users/(your name)/documents/qt/5.12.5/clang_64/bin/qmake qwt.pro)
mac:~ Apple$ make
mac:~ Apple$ sudo make install
Inside your QT Project you have to add the following line to the
.pro insert this line: "include ( /usr/local/qwt-6.1.4/features/qwt.prf )" without quotes
Now you have to create a softlink like this: mac:~ Apple$ sudo ln -s/usr/local/qwt-6.1.4/lib/qwt.framework/qwt /usr/lib/qwt
If you have this error:
dyld: Library not loaded: qwt.framework/Versions/6/qwt
Referenced from: /Users/Desktop/build-check5-Desktop_Qt_5_12_5_clang_64bit2-Debug/check5.app/Contents/MacOS/check5
Reason: image not found
For MacOs Mojave you must copy qwt.framework to the Library/Frameworks folder.

Related

How to get .pro file from the set of qt files

I was trying to modify the source code of this open source project https://github.com/haiwen/seafile-client
As I can see it contains .ui, .qrc etc files which is used in Qt, but there is no .pro files present in his repository. So how to get the .pro file for this repository code. Any idea?
That was the Cmake project , you should install CMake in your system and build it like this :
cmake .
make
make install
OR use CMakeLists.txt instead of .pro .
You can use qmake to generate the .pro file for this repository.
Just do the following steps:
Clone the repo.
cd into the repo
Run the following command
qmake -project -r *
It will repeatedly look into the directory and it's sub-directory files and will generate required .pro file for you.
You can learn more about this at below given link:
https://doc.qt.io/qt-5/qmake-running.html#project-mode-options

Qt creator does not detect opencv

I am trying to run a program in Qt5.6 with openCV3.1, but no matter what I do, it does not detect openCV include.
Projects -> Build Environment -> Include :
I added C:\opencv\opencv3.1.0\opencv\build\include
Projects -> Build Environment -> LIB:
I added C:\opencv\opencv3.1.0\opencv\build\x64\vc14\lib
However, still in the code there is a yellow line indicating that it doesn't detect opencv:
and there are lots of errors like this:
The environment variable for openCV is also set as:
C:\opencv\opencv3.1.0\opencv\build
How should I install Qt with openCV to avoid these problems?
In the .pro file, add the following lines:
INCLUDEPATH += C:\opencv\opencv3.1.0\opencv\build\include
LIBS += -LC:\opencv\opencv3.1.0\opencv\build\x64\vc14\lib \
opencv310.lib \
And also you need to add the .dll file's path C:\opencv\opencv3.1.0\opencv\build\x64\vc14\bin to the system path (this time you need to restart the Qt IDE)

qmake error : could not find a Qt installation of ''

Error-
$ qmake
qmake: could not find a Qt installation of ''
I installed Qt Version 4.8.2
Partial File of .profile in my home directory
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
PATH="/usr/local/Trolltech/Qt-4.8.2/bin:$PATH"
PATH="/home/user/qt-everywhere-opensource-src-4.8.2/bin:$PATH"
export PATH
fi
Output-
$ which qmake
/usr/bin/qmake
Properties
Name - qmake
Type - Link to executable (application/x-executable)
Link Target - qtchooser
Location - /usr/bin
qmake is present in this location
/usr/local/Trolltech/Qt-4.8.2/bin
Properties
Name - qmake
Type - executable (application/x-executable)
Size - 3.4 MB (3,407,312 bytes)
Location - /usr/local/Trolltech/Qt-4.8.2/bin
qmake is also present in this location
/home/username/qt-everywhere-opensource-src-4.8.2/bin
Properties
Name - qmake
Type - executable (application/x-executable)
Size - 11.2 MB (11,157,974 bytes)
Location - /home/username/qt-everywhere-opensource-src-4.8.2/bin
How to make qmake work? Which one is the correct path for qmake?
This is really simple. You don't need to modify any environmental variables, you don't need to set up QTDIR. There are only two facts you need to keep in mind:
You must invoke qmake from your desired version of Qt.
There's a 1:1 relationship between a particular installed Qt version and build, and qmake executable.
After the desired qmake was run and generated the makefile, invoking make will build your project using the version of Qt the qmake came from. This will happen in spite of any environmental variable settings etc.
So, all you need to know is which Qt installation you want to use, and its path. This should be obvious since you installed Qt yourself. There lies the bin/qmake that you need.
You can select the desired qmake just as you would select a particular binary to run. The process is not any different just because it is qmake and not, say gzip:
by explicitly typing out the path to the executable,
by using a shell alias,
by putting the desired Qt's bin folder onto the PATH.
Only you know where you installed your desired version of Qt - there are at least three paths in your question. Thus it's impossible to tell which qmake are you to invoke. Obviously one of them - the one picked up by which qmake - doesn't work.
You need to invoke the one that came with the version of Qt that you installed.
That's really all there's to it.
I think the source code is in this location:
/home/user/qt-everywhere-opensource-src-4.8.2/bin
and installation directory is at:
/usr/local/Trolltech/Qt-4.8.2/bin
you need to add the installation directory to your PATH, however if you have an other version (like the one in /usr/bin) you need to use /usr/local/Trolltech/Qt-4.8.2/bin/qmake to compile Qt project using this version.
My solution is to add this code to your .profile file:
export QTDIR="/usr/local/Trolltech/Qt-4.8.2"
export PATH="$QTDIR/bin:$PATH"
alias qmake-4.8="$QTDIR/bin/qmake"
after that use qmake-4.8 instead of qmake

How to Include OpenSSL in a Qt project

I'm new to Qt, I've done some Googleing and can't find a detailed enough answer.
I need to use OpenSSL in my qmake-based Qt project. How do I go about downloading/installing/linking it so I can just do an include statement and use its functions in my code?
Assuming Windows, you can download its installation from Win32 OpenSSL Installation Project page. You can choose one for 64-bit windows developing or for 32-bit. Just run the setup and everything will be done easily. The default installation directory is : C:\OpenSSL-Win32
In Qt creator, if you then want to link a library to your project you can just add this line to your .pro file(project file ) :
LIBS += -L/path/to -llibname
So here's what we do for this library( for example to link ubsec.lib )
LIBS += -LC:/OpenSSL-Win32/lib -lubsec
Pay attention to -L and -l.See this question. You don't even need to specify .lib at the end of the library name.
For including .h files add this line to your .pro file :
INCLUDEPATH += C:/OpenSSL-Win32/include
after that you can include a file like this :
#include <openssl/aes.h>
From George at Unable to use AES files of OpenSSL in Qt Creator:
If this is on Linux, add the following into your .pro file:
PKGCONFIG += openssl
It will handle all necessary header paths, compile-linker options and
the libraries.
And make sure you have the openssl-devel package installed in your
system.
I was working on Win 7 (32) with Qt5.5, and non of these answers worked for me.
So I just want to share a solution that finally worked:
1. I have OpenSSL installed in C:\OpenSSL-Win32
2. In c:\OpenSSL-Win32\MinGW there are two library files:
libeay32.a & ssleay32.a
3. I've made a copy of each of them an renamed the extensions:
libeay32.a -> libeay32.lib & ssleay32.a -> ssleay32.lib
4. I linked libraries in my .pro file this way:
LIBS += -LC:/OpenSSL-Win32/lib/MinGW -llibeay32
LIBS += -LC:/OpenSSL-Win32/lib/MinGW -lssleay32
INCLUDEPATH += C:/OpenSSL-Win32/include
5. I copied 3 .dll files from C:\OpenSSL-Win32:
(libeay32.dll, libssl32.dll, ssleay32.dll)
to my build/debug folder:
(build-XXXXX-Desktop_Qt_5_5_1_MSVC2012_32bit-Debug/debug)
I hope this will help.
If you use cmake as build system for your project, then you may include FindOpenSSL.cmake as follows:
#set(OPENSSL_USE_STATIC_LIBS TRUE) # if you want to use static libssl.a and libcrypto.a
include(FindOpenSSL)
#add_executable(${PROJECT_NAME} ...) or add_library(${PROJECT_NAME} ...)
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS} OpenSSL::SSL OpenSSL::Crypto)
${CMAKE_DL_LIBS} is required on Linux systems to avoid link-time errors like "dlopen symbol not found...". On windows it became empty.
If openssl installation directory is not being standard, then you should provide OPENSSL_ROOT_DIR to cmake, e.g. to add set(OPENSSL_ROOT_DIR "C:/msys64/mingw32") before include or to specify -DOPENSSL_ROOT_DIR:PATH=C:/msys64/mingw32 to cmake executable (in "Projects"->"Build settings"->"CMake" tab).
if you are on win7,and your qt version is mingw, and u install openssl from http://slproweb.com/products/Win32OpenSSL.html ,make sure your lib should be in the OpenSSL-Win32/lib/MinGW, and add a "lib" pre to the libeay32.a and ssleay32.a 。

Can't link qwt in Qt

I use LIBS flag to link qwt library to my project. So in .pro of my project i have
LIBS += -L/home/Desktop/qwt-6.0.1/lib -lqwt
But anyway Qt does not recognize qwt classes. What i'm missing ??
I think you forgot to include the headers.
Try to add the following
INCLUDE += /home/Desktop/qwt-6.0.1/include
I had same problem. you have to use -L switch and set your library path as bellow:
LIBS+= -L "/home/Desktop/qwt-6.0.1/lib/" -lqwt
adding above line to the .pro file resolve compiling error of the project. then for running Application you should link libqwt.so.6.1.3 to default library path on your system using bellow command:
ln -s /home/Desktop/qwt-6.0.1/lib/libqwt.so.6.1.3 /usr/lib/libqwt.so.6
or simply update LD_LIBRARY_PATH using below command:
export LD_LIBRARY_PATH=/home/Desktop/qwt-6.0.1/lib/lib:$LD_LIBRARY_PATH
I advice you to use the first approach.

Resources